Pass parameters to CfnInclude
See original GitHub issueAllow 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 for CfnParameter
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.
import cdk = require("@aws-cdk/core");
import fs = require("fs");
new cdk.CfnInclude(this, "ExistingInfrastructure", {
template: JSON.parse(fs.readFileSync("my-template.json").toString())
});
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (4 by maintainers)
Top Results From Across the Web
class CfnInclude (construct) · AWS CDK
Returns the CfnParameter object from the 'Parameters' section of the included template. Any modifications performed on that object will be reflected in the ......
Read more >typescript - How can I pass (optional) parameters directly from ...
So we have a bunch of CloudFormation template written and we'd like to deploy them via CDK so we write code to construct...
Read more >@aws-cdk/cloudformation-include - npm
fromCfnKey() method - and passing the L1 instance as an argument: declare const cfnTemplate: cfn_inc.CfnInclude; const cfnKey ...
Read more >How to use Parameters in AWS CDK - Complete Guide
Parameters are key value pairs that we pass into the CDK stack at deployment time.
Read more >awslabs/aws-cdk - Gitter
Solomon. @udohsolomon. @mrpackethead Please can I dm you? Andrew. @mrpackethead. sure. Andrew. @mrpackethead. can i pass parameters to cdk.CfnInclude.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
cdk-dasm is helpful as well
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)