Skip to content
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

cloudformation-include: setting templateOptions.description appends the description in the imported stack, rather than replacing it #28932

Closed
jbschooley opened this issue Jan 31, 2024 · 4 comments
Labels
@aws-cdk/cloudformation-include Issues related to the "CFN include v.20" package bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@jbschooley
Copy link

Describe the bug

I import a stack and set description in my stack's props. Instead of overriding the imported description, it appends the description from the imported stack to the provided description. There seems to be no way of fixing this other than changing the description in the imported template.

Use case: We have outgrown Amplify and are working on rebuilding our stack in CDK with as smooth of a transition as possible, as the backend is being used in production, and the Amplify backend is still actively being developed. As such, we want CDK to generate templates as similar as possible to what Amplify produces, so we want to remove everything possible from the diff to ensure we aren't missing anything. Amplify often changes up the description in the templates it produces, but cfn sometimes doesn't actually update the description (unless you also add tags) so the Amplify generated template won't match what's currently in cfn. So we try to override the description in cdk with this.templateOptions.description, but it just prepends it to the imported description.

image

Expected Behavior

this.templateOptions.description should override the description. I can override anything else from an imported stack, and the description should be no exception.

Current Behavior

CDK provided description is prepended to imported description. If imported description is {"createdOn":"Windows","createdBy":"Amplify","createdWith":"12.10.1","stackType":"auth-Cognito","metadata":{}} and CDK provided description is Amplify Cognito Stack for AWS Amplify CLI (to match what is already in cfn, which for whatever reason doesn't update along with the rest of the stack), the description becomes

Amplify Cognito Stack for AWS Amplify CLI
{"createdOn":"Windows","createdBy":"Amplify","createdWith":"12.10.1","stackType":"auth-Cognito","metadata":{}}

and there is no way to get it out of the diff.

Reproduction Steps

  • Import a template with cloudformation-include that has a description
  • Set the description in CDK this.templateOptions.description = 'New Description' after the import
  • cdk diff

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.124.0 (build 4b6724c)

Framework Version

No response

Node.js Version

v20.11.0

OS

Windows 11 22H2

Language

TypeScript

Language Version

No response

Other information

No response

@jbschooley jbschooley added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 31, 2024
@github-actions github-actions bot added the @aws-cdk/cloudformation-include Issues related to the "CFN include v.20" package label Jan 31, 2024
@pahud
Copy link
Contributor

pahud commented Jan 31, 2024

Thanks for the report. Are you able to provide a minimal working code sample so we can copy/paste and reproduce that in our environment?

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 31, 2024
@jbschooley
Copy link
Author

Sure: https://github.com/jbschooley/cdk-description-bug

Steps to reproduce:

  1. Deploy
  2. Remove comment from description (cdk-description-bug-stack.ts line 15)
  3. cdk diff

image

@pahud
Copy link
Contributor

pahud commented Jun 3, 2024

This seems a bug and I don't have any workaround. Making it a p1.

@pahud pahud removed the p2 label Jun 3, 2024
@pahud pahud closed this as completed Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/cloudformation-include Issues related to the "CFN include v.20" package bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

No branches or pull requests

2 participants