-
Notifications
You must be signed in to change notification settings - Fork 4k
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 parameters to CfnInclude #4994
Comments
I wonder if it would be possible for |
When using CfInclude nothing is stopping you from using parameters in that stack. You can even use cdk parameters and then import. As long as the ID is aligned it'll work. I did something similar here: https://gist.github.com/joekiller/36f28eeffeeb50d3c0f4373c3d372d9e Note to parse and then include the stack I had to make the yaml "clean" ie no bang (!Ref) functions. Use Fn::Ref instead. Your yaml module may vary (YYMMV) |
Typically you can do, app=core.App() And it's there. |
If I wasn't clear enough. Parameters import fine. If you want to replace those you can do something like my gist where you set the default of the parameter to what you want. |
I have been reading about making use of context to provide defaults to when using Reading in existing templates parsing them as JSON/YAML and modifying them as necessary is a great first step and works for now. Thanks @joekiller! |
cdk-dasm is helpful as well |
I'm interested in putting a resource value into a parameter 'Default' of an included CFN, for example, an S3 bucket name, the bucket is defined in another CDK stack. Is it feasible for your experience? I know, by default, CDK does 'Fn::ImportValue' and stack 'Outputs::Export' for you. Since parameters are a little bit tricky here, they don't take intrinsic functions (and I don't think it makes any sense), any clue how to orchestrate this? is this another anti-pattern thing? (maybe this should leave to the CDK team...) |
would love to see something implemented right into CfnInclude. Something like a attribute in the struct like params where you can supply a structure of key/values. Of course one can do this manually like @joekiller did, but life is too short ;-) Context: i am going to import the InstanceSheduler template which has tons of params. |
@logemann there is a --parameter switch now but you cannot set it any way other than via CLI. I'd like it if I could provide a map of parameters to a cloudformation context. I ended up having to double down on some CLI switches. See #7576 (comment) |
…9543) ---- Closes #4994 Cfn-Include can now be passed a mapping of parameters and their values. Specified parameters will have all references to them replaced with the passed value at build time, and their definitions will be removed from the template. Unspecified parameters and references to them will not be modified. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Allow passing parameters to template included via
CfnInclude
.Use Case
It would be nice to be able to reuse existing templates (from quickstarts for example) that rely on parameters being passed to them.
Proposed Solution
Not really sure but my workaround is to remove the parameters and hardcode them.
Perhaps
CfnInclude
could have a prop forCfnParameter
s?Other
Reference example of importing an existing template. Imagine the template has parameters. The drupal quickstart is an example of a quickstart with many parameters.
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: