aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(cli): deploy stack with --parameters option specifying stack is ignored (MyStack:Parameter="Value")

Open markussiebert opened this issue 4 years ago • 15 comments

When using the cdk deploy option cdk deploy '*' --parameters MyStack:MyParam=MyValue the parameter will be ignored.

Reproduction Steps

  1. Create a multi stack application, where you use a parameter in only one of the multiple stacks.
  2. Use the option cdk deploy '*' --parameters MyParam=MyValue will fail, because only one stack needs the parameter: Parameters: [MyParam] do not exist in the template
  3. Use the option cdk deploy '*' --parameters MyStack:MyParam=MyValue will fail, because the stack needing the parameter says: The following CloudFormation Parameters are missing a value: MyParam

What did you expect to happen?

I expected that cdk can handle passing a parameter to only one stack. This behaviour is described here: https://docs.aws.amazon.com/cdk/latest/guide/parameters.html

What actually happened?

you can only pass parameters to all, or no stack

Environment

  • CDK CLI Version : 1.79.0
  • Framework Version: 1.79.0
  • Node.js Version: 12.18.4
  • OS : mac
  • Language (Version): TypeScript

This is :bug: Bug Report

markussiebert avatar Jan 28 '21 23:01 markussiebert

To me, this feels like it should be a warning instead of an error.

ghost avatar Feb 01 '21 21:02 ghost

Huh? For me I think it should work as described in the documentation. Even nowing parameters are somehow deprecated, it is the only way getting secrets into custom resources. So I consider this as a bug.

master7811 avatar Feb 02 '21 07:02 master7811

Hi, I'm getting this also. I am building a parameters argument and passing it to the CLI in Github actions. I get the error "CdkStack failed: Error: The following CloudFormation Parameters are missing a value: uploadbucketname"

mitchboulay avatar Dec 22 '21 01:12 mitchboulay

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Dec 22 '22 04:12 github-actions[bot]

still not fixed?

markussiebert avatar Dec 22 '22 14:12 markussiebert

Any updates on this? I'm having the same problem.

tdluk avatar Mar 17 '23 15:03 tdluk

For anyone else experiencing this issue, the problem is the documentation isn't very clear. The stack name is the value in stackName property (or what the stack name in Cloudformation will be), not the construct ID. So, if your stack name in CFN is mystack-dev, the parameter will be mystack-dev:Parameter=Value, not MyStack:Parameter=Value

anigenero avatar Mar 23 '23 15:03 anigenero

Any updates on this? I'm having the same problem.

nickyshankar avatar Nov 20 '23 04:11 nickyshankar

It appears that the reported issue has been resolved. The version in use, which is v1, is deprecated. I conducted tests on the feature utilizing version v2.138.0. During testing, I replicated the scenario by creating multiple stacks, with only one stack necessitating parameters. Subsequently, I executed the deployment of all stacks using the command cdk deploy --all --parameters StackWithParameter:BucketName=uploadbucket3456, and the deployment proceeded successfully. As a result, I am closing the issue. If you have any further inquiries or concerns, please feel free to reach out.

SankyRed avatar May 02 '24 17:05 SankyRed

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar May 02 '24 17:05 github-actions[bot]

I have recreated a similar scenario comprising multiple stacks, with one stack necessitating parameters that can be passed on during the deployment.

Steps taken to check if the issue works:

> cdk ls // listing stacks
- MultiStackCdkAppStack
- StackWithoutParameter
- StackWithParameter

Of the list of the stacks displayed above StackWithParameter requires bucketName as the parameter and if not passed on while deploying we have a default set as well.

Running cdk deploy --all or cdk deploy '*'. Deploys all the three stacks with the default bucket name.

Running cdk deploy '*' --parameters StackWithParameter:BucketName=uploadbucket3456 deploys the stacks successfully. Screenshot 2024-05-03 at 1 17 12 PM Screenshot 2024-05-03 at 1 57 53 PM

Also, tested the feature with hierarchal structure and works successfully.

Steps taken to check if it works:

> cdk ls // listing stacks
- MultiStackCdkAppStack
- MultiStackCdkAppStack/StackWithoutParameter
- MultiStackCdkAppStack/StackWithParameter

Running cdk deploy --all or cdk deploy '**'. Deploys all the three stacks.

Running cdk deploy '**' --parameters MultiStackCdkAppStack/StackWithoutParameter:BucketName=uploadbucket3456 deploys the stacks successfully.

Also tested it using the --all flag instead of '*' and that works as well.

As per the request it seems like we can deploy all stacks passing in parameters for specific stacks.

Environment CDK CLI Version : 2.138.0 Node.js Version: 18.19.1 OS : mac Language (Version): TypeScript

@markussiebert Can you please specify if the issue exists on your end?

SankyRed avatar May 03 '24 19:05 SankyRed

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.

github-actions[bot] avatar May 06 '24 20:05 github-actions[bot]

@nickyshankar @tdluk Hello, I'm checking to see if the issue still persists on your end? Can anyone please confirm if the issue persists and also if you could please specify the environment it would be helpful.

SankyRed avatar May 06 '24 21:05 SankyRed

@nickyshankar @tdluk Hello, I'm checking to see if the issue still persists on your end? Can anyone please confirm if the issue persists and also if you could please specify the environment it would be helpful.

Works fine for me. My problem was I was using the stack's construct ID instead of the stack name. This comment made things clear for me -> https://github.com/aws/aws-cdk/issues/12759#issuecomment-1481397047

tdluk avatar May 07 '24 08:05 tdluk

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.

github-actions[bot] avatar May 09 '24 12:05 github-actions[bot]

We've updated our documentation to provide clarification on this issue. For more information, see Deploying with parameters in the AWS CDK Developer Guide.

evzzk avatar May 17 '24 23:05 evzzk