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

cdk.Include: support passing in parameters to included template #1454

Closed
eladb opened this issue Dec 30, 2018 · 4 comments
Closed

cdk.Include: support passing in parameters to included template #1454

eladb opened this issue Dec 30, 2018 · 4 comments
Assignees
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved.

Comments

@eladb
Copy link
Contributor

eladb commented Dec 30, 2018

Users expect to be able to pass in parameters to the included template

@rix0rrr rix0rrr added the gap label Jan 4, 2019
@arvindshekar07
Copy link

arvindshekar07 commented Jan 14, 2019

I too have a similar issue specially when attempting a blue green deployment.

@jeshan
Copy link

jeshan commented Aug 27, 2019

I found a simple workaround:

from cfn_tools import load_yaml # or load_json
template = load_yaml(open('templates/your-template.yaml').read())

From there, you can manipulate the template as you please, e.g set the default value to the desired value:

template['Parameters']['YourParam']['Default'] = 'YourValue'

It leverages AWS's cfn-flip library: pip install cfn_flip. The example is in Python but note that this is a CLI tool as well if you need it for other languages.

@NGL321 NGL321 added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 10, 2019
@NGL321 NGL321 added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 10, 2019
@eladb eladb added feature-request A feature should be added or improved. @aws-cdk/aws-cloudformation Related to AWS CloudFormation @aws-cdk/core Related to core CDK functionality and removed closing-soon This issue will automatically close in 4 days unless further comments are made. gap pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Sep 11, 2019
@ilepadatu-pentalog
Copy link

We need this feature. The problem inherent with Default is that in Cloud Formation the value of the Default field cannot reference the output of another template.
That is, if I want to pass to a cfn template parameter the output of of another template, I am unable to, due to CloudFormation limitations.
The work-around is to modify the template, that is remove all the parameters declarations that should accept references and replace the statements where they are assigned with the references from another stack by loading the template into a variable, pretty much as @jeshan described (I used json instead). But the template will never work as it was edited...
I find this very useful in case one wants to embed already existing cfn templates in their cdk code and leave the templates clean to have a way of passing outputs from cdk stack as input parameters to an already existing template without modifying it.

@eladb eladb added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md labels Jan 23, 2020
@eladb eladb removed the @aws-cdk/aws-cloudformation Related to AWS CloudFormation label Mar 19, 2020
@eladb eladb assigned skinny85 and unassigned eladb Apr 8, 2020
@eladb eladb removed the effort/small Small work item – less than a day of effort label Apr 8, 2020
@skinny85 skinny85 added effort/medium Medium work item – several days of effort and removed good first issue Related to contributions. See CONTRIBUTING.md labels Apr 9, 2020
@skinny85
Copy link
Contributor

This is now possible with the new cfn-include module.

Resolving, please let us know if there's anything else we can do for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

7 participants