-
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
SSM: Cannot update a value on deploy #31058
Comments
@asdfractal Good morning. The above error is thrown by the CloudFormation, not the CDK. However, somehow, I'm unable to reproduce the issue at my end. Used the below code (used CDK version import * as cdk from 'aws-cdk-lib';
import * as ssm from 'aws-cdk-lib/aws-ssm';
export class CdktestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const ssmParam = new ssm.StringParameter(this, 'ssmParam', {
parameterName: '/someparameter/name',
stringValue: 'value',
description: 'description',
});
}
}
This created new version of SSM parameter: Are you re-deploying the SSM parameter as part of same stack or a different stack? I used the same stack. Thanks, |
Hi @ashishdhingra. Thanks for the reply and for testing. Unfortunately my reproduction steps were not great, sorry about that. I'm having difficulty reproducing this, I've tried to simulate it with a simple stack but it works as expected. So it is most likely due to an issue with our infrastructure. I have only recently joined a new team and just working on it, so please forgive my ignorance on the subject. This is the comparison between the real app stack diff, and my test stack
As you can see on the first output (real stack), the parameters will be destroyed and created. This causes the error. To create the test stack this is the full code I have used
Then I would rename This is as close as I can to copy our infrastructure without creating too much to provide you with a simple example. If you have any understanding of why it might show destroy vs replace please share. |
@asdfractal Thanks for your response.
Thanks, |
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. |
@ashishdhingra At least now I can confirm the value is updated as expected, so not changing the ID can be dealt with. Thanks for the assistance! |
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
When I change the value of a resource that is creating an SSM parameter, the deploy fails with error
/infra/redacted/ecr/registry already exists in stack
In this case it is renaming the ecr, which we are storing as SSM parameters for cross stack references.
To be transparent - I'm very new to using cdk and not in a platform team, we just want some test pipelines set up. So I'm not sure if this is a bug but what I'm looking for is a way I could update an ssm parameter value when updating a stack deployment.
Expected Behavior
Running
cdk diff
gives this outputExpected behavior is that this is executed as shown in the diff. Destroying the current parameter and then creating the new one.
Even further expected behavior would be that it is not required to destroy it but instead update the value of the parameter...but I can't find any information about doing this.
Current Behavior
Deploy failed due to resource already existing
Reproduction Steps
Deploy the parameter.
Change the value to something else, with the same name.
Deploy again.
Possible Solution
Allow an update of parameter values easily, either through destroy/re-create or just an update to the value. I'm not sure if this is the intended way to update an SSM but there doesn't seem to be any documention around it through SSM.
If this constructor is not intended for update, then maybe there should be something like create_or_update?
Additional Information/Context
No response
CDK CLI Version
2.151.0 (build b8289e2)
Framework Version
No response
Node.js Version
v20.13.1
OS
Ubuntu
Language
TypeScript
Language Version
Version 5.5.4
Other information
No response
The text was updated successfully, but these errors were encountered: