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

aws-cdk: deploy metadata changes without resource changes #28205

Open
JohnYoungers opened this issue Nov 30, 2023 · 4 comments
Open

aws-cdk: deploy metadata changes without resource changes #28205

JohnYoungers opened this issue Nov 30, 2023 · 4 comments
Labels
bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI

Comments

@JohnYoungers
Copy link

JohnYoungers commented Nov 30, 2023

Describe the bug

I have an embedded secret resolve that I'd like re-calculated on-demand for a given stack: it sounds like the easiest way to accomplish this is to add an item to the template that will result in a small change in order to trigger checking the secret's latest value.

To do so I've added this to the example stack: this.addMetadata("SecretResolveTrigger", new Date());

Running cdk diff will display the change:

Metadata
[~] Metadata SecretResolveTrigger: 2023-11-29T20:27:19.233Z to 2023-11-30T13:49:58.970Z

However, running cdk deploy will not update the value:

my-stack
my-stack: deploying... [1/1]
my-stack: creating CloudFormation changeset...

 ✅  my-stack (no changes)

Is there a way to update the template even when there are no changes? Or is there a better way to re-trigger an embedded resolve?

Expected Behavior

I'd expect the metadata to be updated in the template even though no other resource was updated

Current Behavior

Nothing is updated in cloudformation

Reproduction Steps

Create a stack, including an .addMetadata("SecretResolveTrigger", new Date()); entry, and run npx cdk deploy twice: notice the metadata was not updated the second time

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.81.0

Framework Version

No response

Node.js Version

21.2.0

OS

Windows 10

Language

TypeScript

Language Version

5.2.2

Other information

No response

@JohnYoungers JohnYoungers added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 30, 2023
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Nov 30, 2023
@khushail khushail self-assigned this Nov 30, 2023
@khushail
Copy link
Contributor

Hi @JohnYoungers ,thanks for reaching out. You could try using this flag "--force" - https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/README.md#cdk-deploy

cdk deploy --force -v

Here is a detailed explanation of how to use '--force'.

Let us know if this works for you.

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Nov 30, 2023
@JohnYoungers
Copy link
Author

Hi @khushail - adding --force -v seems to result in the same behavior:

[12:06:49] Command line arguments: {
  _: [ 'deploy' ],
  force: true,
  f: true,
  v: 1,
  verbose: 1,
  ...
...
[12:07:05] my-stack: checking if we can skip deploy
[12:07:05] my-stack: forced deployment
[12:07:05] my-stack: deploying...
[12:07:05] Removing existing change set with name cdk-deploy-change-set if it exists
[12:07:05] Attempting to create ChangeSet with name cdk-deploy-change-set to update stack my-stack
my-stack: creating CloudFormation changeset...
[12:07:05] Initiated creation of changeset: arn:aws:cloudformation:us-east-1:{account}:changeSet/cdk-deploy-change-set/{guid}; waiting for it to finish creating...
[12:07:05] Waiting for changeset cdk-deploy-change-set on stack my-stack to finish creating...
[12:07:06] No changes are to be performed on my-stack.
[12:07:06] Deleting empty change set arn:aws:cloudformation:us-east-1:{account}:changeSet/cdk-deploy-change-set/{guid}

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 30, 2023
@jkoepcke
Copy link

We had the same issue, even though for us it was not an issue. However, since recently we can see that behavior changed, now metadata updates are not only showing in diff, but lead to a Stack update. Not sure if a change in Cloudformation or CDK caused this.

@jkoepcke
Copy link

Here we have to opposite request.

@khushail khushail removed their assignment Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

3 participants