Unable to update only Stack description
See original GitHub issueWhen adding a stack description (via the cdk.StackProps object and its description parameter), a cdk deploy
will not find any changes and will abort stack update.
However, a cdk synthesize
will generate a YAML file with the correct description and uploading this YAML file via CloudFormation will result in the stack having the new description.
Reproduction steps
mkdir cdk-stack-example
(non-existing folder)cd cdk-stack-example
cdk init --language=typescript
- open ./lib/cdk-stack-example-stack.ts and change it to:
export class CdkStackExampleStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, {
env: {
account: process.env['AWS_ACCOUNT_ID'],
region: process.env['AWS_REGION'],
},
});
}
}
I just use the account id and the region as environment variables.
5. cdk deploy
(with valid default AWS credentials)
6. Note successfuly deployment of the CloudFormation stack
7. Change the stack code to:
export class CdkStackExampleStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, {
env: {
account: process.env['AWS_ACCOUNT_ID'],
region: process.env['AWS_REGION'],
},
description: 'My Stack' // <- this is new!
});
}
}
cdk deploy
- Note the output is: “CdkStackExampleStack (no changes)” and note that no changes were performend via CloudFormation on the stack
cdk synthesize
- note the description is in the synthesized YAML
- upload this YAML either via the AWS CLI or via the AWS Web Console and note that the CloudFormation stack now has the description updated/added.
The above example is a stack only with the CDKMetadata custom resource, but the issue also persists with a stack with actual CloudFormation resources.
Also, this issue persists under Linux/Ubuntu. The actual bug was detected in a CI/CD deployment on a shared GitLab CI/CD runner, which performed the CDK calls.
Environment
- CLI Version : 1.26.0 (build e251651)
- Framework Version: 1.26.0
- OS : Windows 10 x64 / Linux Ubuntu x64
- Language : typescript
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I think the problem is that CFN reports that the change set includes no changes (because on resources have changed), so we bail out of the deployment.
Can you please provide verbose log (
cdk deploy -v
) so I can make sure this is indeed the case?Yeah, I just tested it with CLI’s
cloudformation update-stack
and it won’t update the stack either, if only the stack description changed… Somehow, the Web Console does something different when selecting to update a stack (from either an S3 URL location or a direct upload). Updating a stack description from the web console works just fine. Okay, I going to close the issue here, because -as you said- CDK can’t do anything about it, because apparently the AWS API does not expose this functionality.