Merged
Conversation
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Bring Your Own Resources
Adds first-class support for importing existing AWS resources into cdk-nextjs constructs, enabling per-branch (MR/PR) deployment patterns where shared infrastructure is created once and lightweight branch stacks reuse it.
New Props
All constructs (via NextjsBaseProps):
cacheBucket?: IBucket — skip S3 cache bucket creation
revalidationTable?: ITable — skip DynamoDB table creation
staticAssetsBucket?: IBucket — skip static assets bucket creation
Container constructs (NextjsGlobalContainers, NextjsRegionalContainers):
alb?: IApplicationLoadBalancer — import an existing ALB
ecsCluster?: ICluster — skip cluster and VPC gateway endpoint creation
removeAutoCreatedListener()
New public method on NextjsContainers that surgically removes the CloudFormation resources ApplicationLoadBalancedFargateService always creates for port 80 (CfnListener, SG ingress rule, CfnOutputs) and rebuilds the ECS service DependsOn. Required when importing an ALB that already has a listener on that port.
Type Fixes
NextjsDistributionProps.loadBalancer: ApplicationLoadBalancer → IApplicationLoadBalancer (accepts imported ALBs)
NextjsCache.revalidationTable: TableV2 → ITable (public property type)
NextjsComputeBaseProps.revalidationTable: TableV2 → ITable
NextjsPostDeployProps.revalidationTable: TableV2 → ITable
NextjsPostDeployProps.staticAssetsBucket: Bucket → IBucket
NextjsStaticAssets.bucket: Bucket → IBucket
NextjsContainers.ecsCluster: Cluster → ICluster
Internal table creation remains TableV2 (no CloudFormation resource type change for existing users).
NextjsRegionalContainers.url
Delegates to this.nextjsContainers.url which correctly resolves the DNS name for both owned and imported ALBs.
Other
Dockerfile CMD switched to exec form (CMD ["node", "server.js"]), HOSTNAME moved to ENV
README: BYO resources section with supported resources table, isolation docs, removeAutoCreatedListener() usage
Three new examples in examples/bring-your-own-resources/ (global-functions, global-containers, regional-containers) using fromLookup/fromAttributes/fromBucketName/fromTableName