-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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-lib.TagManager: (is_taggable function stopped working in while migrating from 2.70.0 to 2.88.0) #26495
aws-cdk-lib.TagManager: (is_taggable function stopped working in while migrating from 2.70.0 to 2.88.0) #26495
Comments
Could you provide reproduction code please |
Hi ,
this was all working till 2.70.0 by adding the tags to all the resources that support tagging. |
It would be really helpful if you could please provide a full reproduction which I can copy+paste. I can't be sure exactly how you're using this class you've defined or if there are specific elements in your stack that trigger this error |
Hi,
|
@Ranjith072 While this does not address the bug itself, I think you can simplify your code to not rely on @jsii.implements(aws_cdk.IAspect)
class AddTags:
def visit(self, node):
if isinstance(node, aws_cdk.Stack):
if not isinstance(node, WbStack):
raise Exception("Found a stack that is not extending WbStack")
else:
stack = aws_cdk.Stack.of(node)
aws_cdk.Tag("StackName", stack.stack_name).visit(node)
aws_cdk.Tag("ProjectName", "WesternAva").visit(node)
aws_cdk.Tag("ApplicationName", stack.application_name).visit(node)
aws_cdk.Aspects.of(app).add(AddTags()) |
Hi, I tried the below code as suggested but it didn't add any tags to the resource when i did cdk synth.
|
@Ranjith072 The code you shared in your latest comment has a bug. The |
@rittneje ,
|
also tried it like this and ended up getting the same error.
|
Hi @rittneje ,@peterwoodworth , |
cdk managed singleton lambda functions and aws managed iam policies are some of the resource for which the tags are getting removed after the new release. |
Hi, please find the code snippet below for the full code
|
So the issue is fixed @Ranjith072 ? |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
Hi, |
@Ranjith072, I start seeing the issue on public static isTaggable(construct: any): construct is ITaggable {
const tags = (construct as any).tags;
return tags && typeof tags === 'object' && tags.constructor.name === 'TagManager';
} This may be causing issues only in Python, which means this is either a JSII issue, or this can be rewritten to be understood by Python. I'm not familiar enough with JSII to know much more however |
I'm starting to see this problem when migrating from aws-cdk 2.99.1 to 2.100.0+ versions of the npm package. I have some speculations/suspicions around the aws-service-spec being the cause for the issue but haven't found any solid evidence-backed root cause for the issue. I am using jest and assertions to check for Tag properties in the cdk stack and facing issues trying to resolve them due to changes in the spec/type. Anyone aware of anything around TagManager or Tags having breaking changes? Edit: This is for aws-cdk for typescript btw! |
I'm currently facing the exact same issue as @frankpengau when migrating from 2.50.0 to 2.100.0, the tags are no longer being enforced with the way our custom CDK library is setup to handle tags which is more of a static approach. The issue stems from the initialTagPriority property in the TagManager class and from looking at the updates it's received by AWS it seems like the tags are now being handled dynamically instead. Currently I am attempting a workaround for our library but what it means is that we cannot use any version above 2.70.0 since our stacks extend interfaces for tags that are mandatory in any CDK Deployment we do. |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
aws-cdk-lib.TagManager.is_taggable has stopped working wth cdk python version 2.88.0 with the below error message
Expected Behavior
it should just return the boolean value during the runtime.
Current Behavior
just fails with the error message as in the screenshot.
Reproduction Steps
Try to run synth after migrating to the cdk version2.88.0, it will through the same error message as in the screenshot attached.
Possible Solution
It was working since cdk 2.0 not sure what has changed behind the scen..i see new method called is_taggable_v2 being added to the TagManager class using this will not break the code but it will remove the existing tags.
Additional Information/Context
No response
CDK CLI Version
2.88.0
Framework Version
No response
Node.js Version
14.17.6
OS
macos: ventura 13.5
Language
Python
Language Version
3.8.8
Other information
No response
The text was updated successfully, but these errors were encountered: