(cli): deploy stack with --parameters option specifying stack is ignored (MyStack:Parameter="Value")
When using the cdk deploy option cdk deploy '*' --parameters MyStack:MyParam=MyValue the parameter will be ignored.
Reproduction Steps
- Create a multi stack application, where you use a parameter in only one of the multiple stacks.
- Use the option
cdk deploy '*' --parameters MyParam=MyValuewill fail, because only one stack needs the parameter:Parameters: [MyParam] do not exist in the template - Use the option
cdk deploy '*' --parameters MyStack:MyParam=MyValuewill 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
To me, this feels like it should be a warning instead of an error.
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.
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"
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.
still not fixed?
Any updates on this? I'm having the same problem.
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
Any updates on this? I'm having the same problem.
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.
⚠️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.
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.
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?
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.
@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.
@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
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.
We've updated our documentation to provide clarification on this issue. For more information, see Deploying with parameters in the AWS CDK Developer Guide.