I need to substitute some variables in an external file and embed/include the content in the CloudFormation template.
Current Use Cases
- Substitute CloudFormation pseudoparameters, such as
AWS::Region and AWS::AccountId in external JSON IAM policy documents.
- Substitute the domain name in the HTML email template
What I tried that doesn't work
nil error
...
PolicyDocument: !Sub "${Rain::Include my-iam-policy.json}"
...
Invalid YAML
...
PolicyDocument: !Sub !Rain::Include my-iam-policy.json
...
Fn::Sub is removed
PolicyDocument: !Sub |
Rain::Include my-iam-policy.json
My current workaround is to continue using Fn::Sub and/or Fn::Join for the portion I need to be dynamic. I preprocess the content, and rain embeds the preprocessed file into the email template.