dynamodb: Nested stack cannot depend on a parent stack when replicationRegions specified
See original GitHub issueNested stack synth
fails with error when replicationRegions
is set on DynamoDB Table.
Reproduction Steps
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { NestedStack } from '@aws-cdk/aws-cloudformation';
import { Table, AttributeType } from '@aws-cdk/aws-dynamodb';
export class DynamoNestedStack extends NestedStack {
constructor(scope: Construct, id: string) {
super(scope, id);
new Table(this, 'MyTable', {
partitionKey: { name: 'pk', type: AttributeType.STRING },
replicationRegions: ['us-east-2', 'us-west-1'],
});
}
}
export class CdkNested6726Stack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new DynamoNestedStack(this, 'DynamoStack');
}
}
Error Log
Here’s the error during synth.
throw new Error(`Nested stack '${sourceStack.node.path}' cannot depend on a parent stack '${targetStack.node.path}'`);
^
Error: Nested stack 'CdkNested6726Stack/DynamoStack' cannot depend on a parent stack 'CdkNested6726Stack'
Environment
- CLI Version : 1.24.0
- Framework Version: 1.24.0
- OS : macOS
- Language :TypeScript
Other
I have tried this on CDK version 1.24.0, 1.25.0, 1.26.0, 1.27.0, and 1.28.0.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
class NestedStack (construct) · AWS CDK
Implements IConstruct , IConstruct , IDependable , ITaggable. A CloudFormation nested stack. When you apply template changes to update a top-level stack, ...
Read more >AWS CDK and Amazon DynamoDB global tables
Here I've defined a table with three replication regions. If you deploy this code snippet in the AWS DynamoDB web console, you will...
Read more >awsdynamodb - Go Packages
This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant...
Read more >@aws-cdk/aws-dynamodb | Yarn - Package Manager
Amazon DynamoDB Construct Library. cfn-resources: Stable. cdk-constructs: Stable. Here is a minimal deployable DynamoDB table definition:
Read more >AWS CDK accessing a resource in a parent stack from a ...
I am trying to pass an Arn for a resource created in a parent stack to be used in a nested stack. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cmckni3
replicationRegions
is implemented using a custom resource in a nested stack.Thanks @cmckni3 for opening this issue and being a
NetsedStacks
hero. We are on it! Duplicate issue https://github.com/aws/aws-cdk/issues/6473