-
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
Pass CloudFormation Parameters to "cdk deploy" #1237
Comments
Hey @gmiano we don't currently provide a way to pass parameter values during the deployment. It is something e have considered, but generally speaking we'd advise to make your templates as concrete as possibly by using context instead of parameters. If that's something you can share with us here, I'd like to know more of what you're using parameters for, and what your Continuous Integration solution is. That would help us determine the best way forward. |
Hi @RomainMuller, During a release canvas a specific version of the CloudFormation is built and deployed within an artifactory server. |
We've got kind of a similar process we're trying to implement. Currently, we're using troposphere-based tools to generate a CloudFormation artifact to pass into CodePipeline, and deploy with a CloudFormation action. This artifact contains:
We're liking the concept of reusable constructs in CDK as well as the option to use other languages for managing CloudFormation, but are not sure if its possible to use it to synthesize the same kind of deployment artifact. It seems like we would need to:
Am I correct, or is there a way that we could continue to produce the same kind of artifact we currently are? |
@RomainMuller, saw your stackoverflow reply to a very similar question. We will look at trying that approach. |
My use case is similar to those above, but I can add a couple of points. The main difference I see by not being allowed this at deployment time is split into some pros/cons: Pros of forcing params at build time:
Cons:
All in all - I kind of agree with the 'build time only' parameters because of the simplicity, and because I can still mitigate the Cons I listed. However, I can think of (and can read on this post) a few use cases where I'd want deploy time params. The biggest use case as pointed out here: (#169 (comment)), is helping to increase adoption rates of CDK. I don't know if allowing for deployment parameters would weaken CDK. And if not, maybe it should support deploy time parameters. Let the user decide which approach is best (with the advice of a well written best practices document to guide them :) ) Just my 2 bit ($CAD) |
@fulghum Is this still relevant/should this still be p0? |
This certainly seems relevant to me. It is a necessity to be able to generate a single |
I'd second @jderose9's requirement. I want to be able to define a stack of resources that will be created for a tenant on a SaaS I'm working on. I want to apply this stack for each tenant, so that all tenants have an identical set of resources. I would prefer to supply parameters to a known-good version of |
this is still very relevant. |
just would like to make sure that using context is the preferred approach ? |
Hi @geekybaiyi that solution is not compliant with corporate requirements of reproducibility of deploy in different environments. We moved to terraform that allows us to apply the behaviour we expect. |
I am a bit confused about how the codepipeline can be used to deploy fargate services if we cannot pass parameters from the pipeline to the template at deploy time. |
@RomainMuller sorry for tagging you, but you requested some information to the poster and it seems that you forgot to give any feedback. |
@manast I'm not sure where you got "we cannot pass parameters from the pipeline to the template at deploy time.", but that is not true. The parameterOverrides property of the CloudFormation deployment CodePipeline actions allows you to do that. We have an example using it for Lambda deployments here: https://docs.aws.amazon.com/cdk/latest/guide/codepipeline_example.html Thanks, |
@manast can you look at this example? It uses an older version of the CDK ( Now, there is one important element in that example that is missing from the main library: this special |
@skinny85 yes, this is exactly what I was looking for. And actually the implementation of the PipelineContainerImage is precisely the part of the code that I find more difficult to understand. I am used to use parametersOverride in CF and just pass to standard parameters, but in this case it seems it is using SSM which confuses me a bit. |
I'm not sure where you got the idea that |
I got it from here: https://github.com/rix0rrr/cdk-ecs-demo/blob/master/lib/pipeline-container-image.ts#L8 |
OK. There is more than one class called The one you linked to is an auto-generated class for the SSM The Does this clear things up? |
@manast do you want me to add the |
@skinny85 I would need to revisit that code again since it has passed some weeks now and i do not remember all the details anymore. |
We have had the same issues, where we would like to be able to pass parameters to CloudFormation with cdk deploy. So I have made a pull request with something that we have found to work for us. Please let me know if this could work. |
* feat(aws-cdk): pass cloudformation parameters to "cdk deploy" This commit closes #1237 I have added the command line option --parameters, -P which allows for adding CloudFormation parameters at deploy time. The functionality for deploying with parameters was already present, but I have just added a way for the command line to pass it to the deployment code. The motivation for adding this functionality has been that we have a setup where we share an account with access to CloudFormation, which is why we do not want to have some fields in plain text, while they do not have access to other services, which did not support secrets within the fields we want to keep secret. This allows us to have parameters that can be kept secret from the templates, while also having parameters with NoEcho. I have verified this functionality by both deploying a cdk project with a CfnParameter from @aws-cdk/core, and an original CloudFormation template with parameters. * feat(cli): pass cloudformation parameter to "cdk deploy" This changes the syntax of the --parameter parameter, so that it is now possible to specify which stack a parameter is meant for, i.e. of you want a parameter to apply to `MyStack`, then you would pass it as --parameters MyStack:key=value While still being able to pass parameters to all stacks by omitting the stack name, i.e. --paramters key=value This is being added to support wild card deployments, and deployments with multiple stacks that do not neccessary contain the same parameters. I have verified these changes by deploying a multistack cdk project, where the stacks contains different parameters, and some shared parameters. * feat(cli): pass cloudformation parameters to "cdk deploy" I have added some integration tests of both wildcard and single deployments with parameters. While also fixing a bug found while testing. * feat(cli): pass cloudformation parameters to "cdk deploy" Adding integration test for nested stacks. Adding section in README. * feat(cli): pass cloudformation parameters to "cdk deploy" Adding an example of using parameters to the README.md * update README * more README cleanup Co-authored-by: Elad Ben-Israel <benisrae@amazon.com> Co-authored-by: Shiv Lakshminarayan <shivlaks@amazon.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* feat(aws-cdk): pass cloudformation parameters to "cdk deploy" This commit closes #1237 I have added the command line option --parameters, -P which allows for adding CloudFormation parameters at deploy time. The functionality for deploying with parameters was already present, but I have just added a way for the command line to pass it to the deployment code. The motivation for adding this functionality has been that we have a setup where we share an account with access to CloudFormation, which is why we do not want to have some fields in plain text, while they do not have access to other services, which did not support secrets within the fields we want to keep secret. This allows us to have parameters that can be kept secret from the templates, while also having parameters with NoEcho. I have verified this functionality by both deploying a cdk project with a CfnParameter from @aws-cdk/core, and an original CloudFormation template with parameters. * feat(cli): pass cloudformation parameter to "cdk deploy" This changes the syntax of the --parameter parameter, so that it is now possible to specify which stack a parameter is meant for, i.e. of you want a parameter to apply to `MyStack`, then you would pass it as --parameters MyStack:key=value While still being able to pass parameters to all stacks by omitting the stack name, i.e. --paramters key=value This is being added to support wild card deployments, and deployments with multiple stacks that do not neccessary contain the same parameters. I have verified these changes by deploying a multistack cdk project, where the stacks contains different parameters, and some shared parameters. * feat(cli): pass cloudformation parameters to "cdk deploy" I have added some integration tests of both wildcard and single deployments with parameters. While also fixing a bug found while testing. * feat(cli): pass cloudformation parameters to "cdk deploy" Adding integration test for nested stacks. Adding section in README. * feat(cli): pass cloudformation parameters to "cdk deploy" Adding an example of using parameters to the README.md * update README * more README cleanup Co-authored-by: Elad Ben-Israel <benisrae@amazon.com> Co-authored-by: Shiv Lakshminarayan <shivlaks@amazon.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* feat(aws-cdk): pass cloudformation parameters to "cdk deploy" This commit closes aws#1237 I have added the command line option --parameters, -P which allows for adding CloudFormation parameters at deploy time. The functionality for deploying with parameters was already present, but I have just added a way for the command line to pass it to the deployment code. The motivation for adding this functionality has been that we have a setup where we share an account with access to CloudFormation, which is why we do not want to have some fields in plain text, while they do not have access to other services, which did not support secrets within the fields we want to keep secret. This allows us to have parameters that can be kept secret from the templates, while also having parameters with NoEcho. I have verified this functionality by both deploying a cdk project with a CfnParameter from @aws-cdk/core, and an original CloudFormation template with parameters. * feat(cli): pass cloudformation parameter to "cdk deploy" This changes the syntax of the --parameter parameter, so that it is now possible to specify which stack a parameter is meant for, i.e. of you want a parameter to apply to `MyStack`, then you would pass it as --parameters MyStack:key=value While still being able to pass parameters to all stacks by omitting the stack name, i.e. --paramters key=value This is being added to support wild card deployments, and deployments with multiple stacks that do not neccessary contain the same parameters. I have verified these changes by deploying a multistack cdk project, where the stacks contains different parameters, and some shared parameters. * feat(cli): pass cloudformation parameters to "cdk deploy" I have added some integration tests of both wildcard and single deployments with parameters. While also fixing a bug found while testing. * feat(cli): pass cloudformation parameters to "cdk deploy" Adding integration test for nested stacks. Adding section in README. * feat(cli): pass cloudformation parameters to "cdk deploy" Adding an example of using parameters to the README.md * update README * more README cleanup Co-authored-by: Elad Ben-Israel <benisrae@amazon.com> Co-authored-by: Shiv Lakshminarayan <shivlaks@amazon.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…ant to be used in CodePipeline While CDK Pipelines is the idiomatic way of deploying ECS applications in CDK, it does not handle the case where the application's source code is kept in a separate source code repository from the CDK infrastructure code. This adds a new class to the ECS module, `TagParameterContainerImage`, that allows deploying a service managed that way through CodePipeline. Related to aws#1237 Related to aws#7746
…ant to be used in CodePipeline While CDK Pipelines is the idiomatic way of deploying ECS applications in CDK, it does not handle the case where the application's source code is kept in a separate source code repository from the CDK infrastructure code. This adds a new class to the ECS module, `TagParameterContainerImage`, that allows deploying a service managed that way through CodePipeline. Related to aws#1237 Related to aws#7746
…ant to be used in CodePipeline While CDK Pipelines is the idiomatic way of deploying ECS applications in CDK, it does not handle the case where the application's source code is kept in a separate source code repository from the CDK infrastructure code. This adds a new class to the ECS module, `TagParameterContainerImage`, that allows deploying a service managed that way through CodePipeline. Related to aws#1237 Related to aws#7746
… be used in CodePipeline (#11795) While CDK Pipelines is the idiomatic way of deploying ECS applications in CDK, it does not handle the case where the application's source code is kept in a separate source code repository from the CDK infrastructure code. This adds a new class to the ECS module, `TagParameterContainerImage`, that allows deploying a service managed that way through CodePipeline. Related to #1237 Related to #7746 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
… be used in CodePipeline (aws#11795) While CDK Pipelines is the idiomatic way of deploying ECS applications in CDK, it does not handle the case where the application's source code is kept in a separate source code repository from the CDK infrastructure code. This adds a new class to the ECS module, `TagParameterContainerImage`, that allows deploying a service managed that way through CodePipeline. Related to aws#1237 Related to aws#7746 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Hi,
I already use aws-cdk to create a CloudFormation that represents my infrastructure.
I would like to use CDK Toolkit for Continuous Integration in order to Deploy stack updates.
Unfortunately the stack I am working with contains CloudFormation Parameters and I have not found a way to pass Parameters values yet?
Is there a way, not documented, to achieve this purpose? Are you to integrate this feature in the near future?
Best regards,
Giuseppe.
The text was updated successfully, but these errors were encountered: