Data

You can define custom properties by using the data property. The properties specified in a stack group configuration are available in its children's and stack's configuration files and stack templates files.

Example

If you specify data in a stack configuration file like this:

1data:
2  subnets:
3    - subnet-ccbbb18ac981dc554e
4    - subnet-969b3de3fa0a275d9b
5    - subnet-7609598000b229fcb3
6  environment:
7    name: dev
8    code: 123

Then, you can refer to the properties in the stack template file like so:

1Resources:
2  Bucket:
3    Type: AWS::S3::Bucket
4    Properties:
5      Tags:
6        - Key: Environment
7          Value: { { stack.data.environment.name } }
8        - Key: Code
9          Value: { { stack.data.environment.code } }

Usage In Configuration

data property can be defined in:

  • stack group configuration files
  • blueprint configuration files
  • stack configuration files
  • custom stack configuration files

Stack Group Config File

When data property is defined in a stack group configuration file:

  • its value is merged with the value inherited from the parent stack group
  • its value is inherited by stack groups and stacks that belong under the stack group

Blueprint Config File

When data property is defined in a blueprint configuration file:

  • its value is merged with the value inherited from the parent stack group
  • its value is inherited by stacks that extend the blueprint

Stack Config File

When data property is defined in a stack configuration file:

  • if the stack extends a blueprint, its value is merged with the value inherited from the blueprint
  • otherwise, its value is merged with the value inherited from the parent stack group

Custom Stack Config File

When data property is defined in a custom stack configuration file:

  • its value is merged with the value inherited from the parent stack group

Configuration Merging

Configuration merging happens when a stack group, blueprint or stack inherits data property but also defines data property of its own.

Data objects are merged recursively.

Requirements

The data property must satisfy these requirements:

  • Must be an object