question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass parameters to CfnInclude

See original GitHub issue

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 for CfnParameters?

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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cmckni3commented, Dec 6, 2019

cdk-dasm is helpful as well

1reaction
joekillercommented, Nov 26, 2019

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found