Skip to content
Discussion options

You must be logged in to vote

I think only tags of resources created in the current CDK application can be set in this way. The tags are added to the resource declarations in the stack template where they are defined.

Tagging resources outside of the application would be unstable in cases since the resource could be recreated by the code that manages that resource (in case of IaC). The tags would no longer be on the resource. Tagging this way could be achieved with a custom resource, but the ownership of a Tag cannot be determined, so could lead to unstable situations too.

However I think that both:

cdk.Aspects.of(vpc).add(new cdk.Tag('TestTag', 'test'));
cdk.Tags.of(vpc).add('TestTag', 'test');

could throw an excepti…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by devdemos
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants