Created
June 16, 2020 08:55
-
-
Save benbridts/5681541aa43a673267db1aaa6b3d1b82 to your computer and use it in GitHub Desktop.
CloudFormation template only outputting the not empty parameters
This file contains hidden or 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
| --- | |
| Parameters: | |
| Parameter01: | |
| Type: String | |
| Default: '' | |
| Parameter02: | |
| Type: String | |
| Default: '' | |
| Parameter03: | |
| Type: String | |
| Default: '' | |
| Conditions: | |
| NotP01: !Equals [!Ref Parameter01, ''] | |
| NotP02: !Equals [!Ref Parameter02, ''] | |
| NotP03: !Equals [!Ref Parameter03, ''] | |
| Outputs: | |
| NotEmptyParameters: | |
| Description: Only outputs the parameters that are not empty | |
| Value: | |
| !Join | |
| - ', ' | |
| - | |
| - !If [NotP01, !Ref "AWS::NoValue", !Sub "Parameter01=${Parameter01}"] | |
| - !If [NotP02, !Ref "AWS::NoValue", !Sub "Parameter02=${Parameter02}"] | |
| - !If [NotP03, !Ref "AWS::NoValue", !Sub "Parameter03=${Parameter03}"] | |
| Resources: | |
| Dummy: | |
| Type: AWS::CloudFormation::WaitConditionHandle | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment