-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cdk: Tag does not produce tags on the target resource #27355
Comments
Hi @graemevwilson , the Tag is deprecated as mentioned here. Use of Tags is recommended way to add the tags. That would also mean the documentation need to be updated. So I am adding documentation label to this issue. |
Thanks @khushail but the deprecated methods that you're highlighting are |
Hey @graemevwilson @khushail, there are currently no issues with the On the topic of deprecation, please note that the Tag class itself is not deprecated, nor is the On the topic of the const vpc = new ec2.Vpc(this, 'Vpc')
new cdk.Tag("Key", "Value").visit(vpc.node.defaultChild as cdk.CfnResource) I think this would be good to clarify in our devguide, as I can see how this is unclear at first |
Thanks for the clarification @peterwoodworth - I have it working now! |
Thanks @peterwoodworth ! 👍 I did the same mistake when trying to tag a specific resource (SQS Queue) within a custom aspect, just like the "PathTagger"-example described here: https://docs.aws.amazon.com/cdk/v2/guide/tagging.html#tagging_single |
Describe the bug
According to https://docs.aws.amazon.com/cdk/v2/guide/tagging.html there are 2 ways of adding tags, either to all resources in a scope or to a specific resource:
or
In CDK 2.99 the latter version, using the Tag class, does not create a tag in the CloudFormation template.
Expected Behavior
Should add a tag of key: value to the specified scope or construct.
Current Behavior
Does not add a tag to the specified scope or construct
Reproduction Steps
Create a CDK application and set
app.py
as follows and runcdk synth
:Inspect the .template file in cdk.out folder and note that the queue construct has no tag.
As a further test, comment line 23 and uncomment line 24. Run
cdk synth
again and on inspection of the .template file a tag will have been added to the queue resource.Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.99
Framework Version
No response
Node.js Version
18.17.1
OS
Windows and Linux
Language
Python
Language Version
3.10.2
Other information
No response
The text was updated successfully, but these errors were encountered: