-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(core): tags not applied to NestedStack resource #17463
Copy link
Copy link
Closed
Labels
@aws-cdk/coreRelated to core CDK functionalityRelated to core CDK functionalitybugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1
Description
Description
If I define a NestedStack and add custom tags, these tags are applied to child resources, but not the NestedStack itself. Is it possible to apply these tags to the NestedStack as well?
export class MyStack extends cdk.Stack {
constructor(scope: Construct, id: string, props: cdk.StackProps) {
super(scope, id, props);
new MyNestedStack();
}
}
export class MyNestedStack extends cdk.NestedStack {
constructor(scope: Construct, id: string, props: cdk.NestedStackProps) {
super(scope, id, props);
cdk.Tags.of(this).add('tag-1', 'value-1');
cdk.Tags.of(this).add('tag-2', 'value-2');
new s3.Bucket(this, 'MyBucket');
}
}Nested Stack tags:
{}
S3 Bucket Tags
{
"tag-1": "value-1",
"tag-2": "value-2"
}
Use Case
We create n NestedStacks, some of the tags we require are specific to individual nested stacks and can not be set in the parent scope. If tags specified on a cdk.NestedStack class applied to the NestedStack (in addition to the stack resources) this would resolve our issue.
Proposed Solution
Apply tags to NestedStacks when declared on class of type cdk.NestedStack.
Other information
➜ npx cdk --version
2.0.0-rc.28 (build 32f0fd1)
Acknowledge
- I may be able to implement this feature request
- This feature might incur a breaking change
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/coreRelated to core CDK functionalityRelated to core CDK functionalitybugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp1