Open cjnoname opened 1 month ago
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this, which doesn't work in version 2.161.1.
Are you able to provide minimal reproducible code snippets so we can quickly reproduce that in our environment?
And, did you mean this was previously working but broken in 2.161.1? If yes, what is the last known working CDK version?
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this, which doesn't work in version 2.161.1.
Are you able to provide minimal reproducible code snippets so we can quickly reproduce that in our environment?
And, did you mean this was previously working but broken in 2.161.1? If yes, what is the last known working CDK version?
Hey mate,
it's all because of this commit: https://github.com/aws/aws-cdk/pull/31457
To reproduce the issue is quite simple - add this line to any of the stacks:
Tags.of(stack).add(
"anytag",
StringParameter.valueForStringParameter(stack, `/app/anytag`)
);
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this.
Error: Stack tags may not contain deploy-time values (tag: awsApplication=${Token[TOKEN.16]}). Apply tags containing deploy-time values to resources only, avoid tagging stacks.
If you see this error, this is because https://github.com/aws/aws-cdk/pull/31457 fixed a bug and doesn't allow stack tags contain unresolved values.
Can you share your minimal code snippets to help us look into your issue?
To reproduce the issue is quite simple - add this line to any of the stacks:
Tags.of(stack).add( "anytag", StringParameter.valueForStringParameter(stack, `/app/anytag`) );
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this.
To reproduce the issue is quite simple - add this line to any of the stacks:
Tags.of(stack).add(
"anytag",
StringParameter.valueForStringParameter(stack, /app/anytag
)
);
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this.
To be honest, I understand that the commit is intended to prevent the generation of incorrect tags in the CloudFormation stack, such as "Tokenxxxx." However, I don't understand why it restricts normal usage. I only want to add the tag once at the stack level, rather than needing to add it 100 times for each resource.
I'm encountering the same error using versions 2.161.0 through 2.162.1 (currently latest) when trying to use a stack parameter in a stack tag. Previously, applying the tag at the stack level like this (using .NET CDK):
var stackParameter = new CfnParameter(this, "StackParameter", new CfnParameterProps
{
Description = "Example",
Type = "String",
});
Tags.Of(this).Add("ExampleTag", stackParameter.ValueAsString);
would apply it to each resource within the stack like this:
{
"Key": "ExampleTag",
"Value": {
"Ref": "StackParameter"
}
},
And the resulting tags had the correct value upon deployment, so I'm not sure why this was considered a bug and is now rejected:
Unhandled exception. System.Exception: Error: Stack tags may not contain deploy-time values (tag: ExampleTag=${Token[TOKEN.18]}). Apply tags containing deploy-time values to resources only, avoid tagging stacks.
@rix0rrr Can you please help on this?
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this, which doesn't work in version 2.161.1.
Are you able to provide minimal reproducible code snippets so we can quickly reproduce that in our environment?
And, did you mean this was previously working but broken in 2.161.1? If yes, what is the last known working CDK version?
If there's no plan to fix this issue in short, could you please help to rollback this commit?
We are encountering the same issue. Is there a workaround?
This is an issue for us as well
IHAC who is facing this issue too and cannot use latest version of CDK. Could you provide an ETA? Thank you :)
Describe the bug
Our CDK application is breaking. We're trying to add tags to all resources within the CloudFormation template by reading the values from the SSM Parameter Store. However, during deployment with the latest version, we're encountering the following error on the latest version:
Error: Stack tags may not contain deploy-time values (tag: awsApplication=${Token[TOKEN.16]}). Apply tags containing deploy-time values to resources only, avoid tagging stacks.
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this.
https://github.com/aws/aws-cdk/pull/31457
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
It should work.
Current Behavior
It does not work.
Reproduction Steps
Our requirement is to add a tag from the SSM Parameter Store to all resources within the stack. Please either resolve this issue or provide an alternative solution to achieve this, which doesn't work in version 2.161.1.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.161.1
Framework Version
No response
Node.js Version
22
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response