Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cfn-include): allow passing Parameters to the included template (#…
…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*
- Loading branch information
Showing
11 changed files
with
375 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"Parameters": { | ||
"MyParam": { | ||
"Type": "String" | ||
} | ||
}, | ||
"Resources": { | ||
"Bucket": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketName": { | ||
"Fn::Sub": [ | ||
"${MyParam}" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"Parameters": { | ||
"MyParam": { | ||
"Type": "String" | ||
} | ||
}, | ||
"Resources": { | ||
"Bucket": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketName": { | ||
"Fn::Sub": [ | ||
"${MyParam}", | ||
{ | ||
"MyParam": { "Ref" : "MyParam" } | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
packages/@aws-cdk/cloudformation-include/test/test-templates/parameter-references.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"Transform" : { | ||
"Name" : "AWS::Include", | ||
"Parameters" : { | ||
"Location" : { | ||
"Ref": "MyParam" | ||
} | ||
} | ||
}, | ||
"Parameters": { | ||
"MyParam": { | ||
"Type": "String", | ||
"Default": "MyValue" | ||
} | ||
}, | ||
"Conditions": { | ||
"AlwaysFalse": { | ||
"Fn::Equals": [ { "Ref": "MyParam" }, "Invalid?BucketName"] | ||
} | ||
}, | ||
"Metadata": { | ||
"Field": { | ||
"Fn::If": [ | ||
"AlwaysFalse", | ||
"AWS::NoValue", | ||
{ | ||
"Ref": "MyParam" | ||
} | ||
] | ||
} | ||
}, | ||
"Resources": { | ||
"Bucket": { | ||
"Type": "AWS::S3::Bucket", | ||
"Metadata": { | ||
"Field": { | ||
"Ref": "MyParam" | ||
} | ||
}, | ||
"Properties": { | ||
"BucketName": { | ||
"Ref": "MyParam" | ||
} | ||
} | ||
} | ||
}, | ||
"Outputs": { | ||
"MyOutput": { | ||
"Value": { | ||
"Ref": "MyParam" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.