-
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-tools): CLI --hotswap -> We don't support attributes of the 'AWS::CloudFormation::Stack' resource #23533
Comments
Any workaround for this is also welcome, since currently even the smallest change takes 4 minutes. |
We should already support the hotswap of resources found in nested stacks #18950 Could you provide the stack code you're using to define this nested stack? Thanks |
Seems you are right. Have tried it with a minimal reproduction Stack and it seems to work great. Will investigate further with my whole setup and check why it doesn't work in our setup. The diff provided by CDK is nearly the same. Feels kinda strange that the diff is the same (except for the generated file ids) but still it refuses in my other case a hotswap. Edit: Strangely it seems to work now. Not sure what changed. |
|
glad to hear it worked out @twixr! Please feel free to report again if you run into this issue again |
Hi @peterwoodworth I got the issue again and spend quite some hours debugging my whole stack (which is quite large with 10 nested stacks or so) I did manage to find the reason why the hotswap wasn't working in my case, and also managed to create a minimal reproduction setup for this.
I do this by passing the If I put in the topicArn hardcoded, then hotswap works. But somehow if I use it as reference from NestedStackA then it is not able to do a hotswap. My Stack code: export class RootStack extends Stack {
constructor(scope: Construct, id: string, stackProps: StackProps) {
super(scope, id, stackProps);
const stack = new NestedStackA(this, `NestedStackA`, stackProps);
new NestedStackB(this, `NestedStackB`, stackProps, stack.snsTopic.topicArn);
}
}
class NestedStackA extends NestedStack {
snsTopic: aws_sns.Topic;
constructor(scope: Construct, id: string, stackProps: StackProps) {
super(scope, id, stackProps);
this.snsTopic = new aws_sns.Topic(this, 'SNSTopic');
}
}
class NestedStackB extends NestedStack {
constructor(scope: Construct, id: string, stackProps: StackProps, snsTopicArn: string) {
super(scope, id, stackProps);
new aws_lambda_nodejs.NodejsFunction(this, 'TestLambda', {
entry: 'test-lambda.ts',
runtime: aws_lambda.Runtime.NODEJS_16_X,
environment: {
SNS: snsTopicArn
}
});
}
} After some extra testing I found out that it has nothing to do with SNS in general, just that we were using that. Hopefully this is useful information. I think for now I can workaround this issue by putting those resources I need in other nested stacks in the root stack rather than in a nested stack. That should hopefully mitigate this issue. |
We also have a large stack with lot nested stacks, each one having multiple lambdas. Those stacks have reference to SSM parameters and the deploy is super long (> 4 minutes) for 2 reasons:
|
I'm getting a very similar error.
I have a parent stack that creates a bunch of resources, including a Cognito UserPool, and a nested stack that mostly contains Lambda Functions. I'm passing down some of the parent resource references to the nested stack and use them in the Lambda Functions. This includes the UserPool. NPM modules:
|
Same issues here. One root stack with four nested stacks. Three of them set up DynamoDB, Kinesis Streams and so on. The last one contains Lambda functions that use some references. Result is:
|
…7195) This PR solves two problems when doing hotswap deployments with nested stacks. 1. Adding capabilities to evaluate CFN parameters of `AWS::CloudFormation::Stack` type (i.e. a nested stack). In this PR, we are only resolving `Outputs` section of `AWS::CloudFormation::Stack` and it can be expanded to other fields in the future. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-cloudformation.html#w2ab1c17c23c19b5 for CFN documentation around using Outputs ref parameters 2. If a template has parameters with default values and they are not provided (a value) by the parent stack when invoking, then resolve these parameters using the default values in the template. Partially helps #23533 and #25418 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I'm also having the same issue. The details are here: #30841 (comment) |
Describe the feature
Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: We don't support attributes of the 'AWS::CloudFormation::Stack' resource. This is a CDK limitation.
Use Case
I work with Nested stacks and I have Lambda in nested stacks.
When I do a code change to a Lambda, I would really like to have hotswap working. This works for the main stack, but for a Lambda code change located in a Nested stack, this doesn't work.
Output of
cdk diff
:As you can see, the Lambda code change in a nested stack triggers a change of type
AWS::CloudFormation::Stack
which is not supported.Proposed Solution
No response
Other Information
Some other similar issues:
#19421
#19644
Acknowledgements
CDK version used
2.58.1 (build 3d8df57)
Environment details (OS name and version, etc.)
Ubuntu 20.04 LTS (Windows WSL2)
The text was updated successfully, but these errors were encountered: