Aws-cdk: [CLI] Parameters are ignored for all subsequent deployments

Created on 25 Jun 2020  Â·  4Comments  Â·  Source: aws/aws-cdk

:question: General Issue

The Question

When deploying a stack using parameters, changes are not detected for any deployment after the initial one.
Using this simple stack :
````typescript
import * as cdk from '@aws-cdk/core';
import { CfnParameter, Fn } from '@aws-cdk/core';
import { CfnBucket } from '@aws-cdk/aws-s3';

export class CdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

const parameter = new CfnParameter(this, "parameter",
{
  type: 'String'
});

const bucket = new CfnBucket(this, "bucket", {
    tags: [
        {key: 'tag', value: Fn.ref(parameter.logicalId)}
    ]
});

}
}
````

The tag is set to "value" using this deployment code :
cdk deploy --parameters CdkStack:parameter=value

But for any subsequent deployments changes are not detected when using a different parameter:
cdk deploy --parameters CdkStack:parameter=newvalue

Using the previous-parameters flag result to the same output:
````
cdk deploy --previous-parameters false --parameters CdkStack:parameter=newvalue
CdkStack: deploying...

✅ CdkStack (no changes)
````

Environment

  • CDK CLI Version: 1.46.0 (build 63860b2)
  • Node.js Version: v12.15.0
  • OS: Windows 10
  • Language: Tested with TypeScript & C#
bug efformedium needs-reproduction p1 packagtools

Most helpful comment

@shivlaks Yes this is working using --force
As a result for my example :
````
cdk deploy --previous-parameters false --parameters CdkStack:parameter=newvalue --force
CdkStack: deploying...
CdkStack: creating CloudFormation changeset...
0/2 | 11:55:31 | UPDATE_IN_PROGRESS | AWS::S3::Bucket | bucket
1/2 | 11:55:51 | UPDATE_COMPLETE | AWS::S3::Bucket | bucket
2/2 | 11:55:52 | UPDATE_COMPLETE_CLEA | AWS::CloudFormation::Stack | CdkStack
2/2 | 11:55:53 | UPDATE_COMPLETE | AWS::CloudFormation::Stack | CdkStack

✅ CdkStack
````

All 4 comments

@Pomdap i got the similar issue too with cdk 1.51.0 with the below:

cdk deploy --previous-parameters false --parameters RdsClusterId=example_id

Got result:

my-stack: deploying...
my-stack: creating CloudFormation changeset...

 ✅  my-stack (no changes)

Have you figured a workaround for it?

@hong823 @Pomdap I haven't gone through the repro steps. I'm wondering if our optimization which determines if there is a change to be made is faulty.

What happens if you use the --force flag when running cdk deploy ...? That should always ensure it gets deployed. It's just a workaround, but see if you can give that a try and let me know how it goes!

@shivlaks Yes this is working using --force
As a result for my example :
````
cdk deploy --previous-parameters false --parameters CdkStack:parameter=newvalue --force
CdkStack: deploying...
CdkStack: creating CloudFormation changeset...
0/2 | 11:55:31 | UPDATE_IN_PROGRESS | AWS::S3::Bucket | bucket
1/2 | 11:55:51 | UPDATE_COMPLETE | AWS::S3::Bucket | bucket
2/2 | 11:55:52 | UPDATE_COMPLETE_CLEA | AWS::CloudFormation::Stack | CdkStack
2/2 | 11:55:53 | UPDATE_COMPLETE | AWS::CloudFormation::Stack | CdkStack

✅ CdkStack
````

@Pomdap thanks for confirming, i'll continue digging into our optimization logic to see why we're incorrectly classifying the changeset as not requiring changes. I'm glad you have a path forward for now. I'll update this issue when I can reproduce and start putting together a PR to fix it.

Was this page helpful?
0 / 5 - 0 ratings