Skip to content

!Rain::Include

!Rain::Include <path> reads a YAML or JSON file and inserts it into the template as an object. cfnrain also processes the directives in the included file. Paths in the included file are relative to that file.

Use it to share tags, policies, or whole resource definitions between templates.

Example

The template:

Resources:
  Bucket:
    Type: AWS::S3::Bucket
    Properties:
      Tags: !Rain::Include tags.yaml

tags.yaml, in the same directory:

- Key: Team
  Value: platform
- Key: CostCenter
  Value: "1234"

The packaged template:

Resources:
  Bucket:
    Type: AWS::S3::Bucket
    Properties:
      Tags:
        - Key: Team
          Value: platform
        - Key: CostCenter
          Value: "1234"
  • !Rain::Embed inserts a file as a string.
  • Modules insert a group of resources, with parameters and outputs.