Init Deploy Config

template: String
stackName: String
forceUpdate: Boolean
tags:
  String: String
variables:
  String:
    String: String
parameters:
  String:
    String: String | import
{
  "template": "String",
  "stackName": "String",
  "forceUpdate": "Boolean",
  "tags":{
    "String": "String"
  },
  "variables": {
    "String": {
      "String": "String"
    }
  },
  "parameters": {
    "String": {
      "String": "String" | "import"
    }
  }
}

template

Type: String

The path to the init deploy template.

Required: No

stackName

Type: String

Init deploy stack name.

Required: No

forceUpdate

Type: Boolean

If true then the init-stack will always update, even if there is no change.

Default: false

Required: No

tags

Type: Map<String,String>

Init deploy stack tags.

Required: No

variables

Type: Map<String,Map<String,String>>

Global variables for the init deploy stack. Will be passed as variables to every AttiniCfn step in the deployment plan. The key should be an environment name (dev, stage, prod, etc) or default.

Anything under default will be used only if the variable is not configured for the current environment.

How are variables different from parameters?

Variables only work within the context of AttiniCfn and its associated configuration files. If you specify Variables with the same keys in a AttiniCfn step, it will override variables in the attini-config.

Parameters are normal AWS CloudFormation parameters to the init deploy stack

Within initDeployConfig in your attini-config file there are a few variables that are always available.

environment

Will always transform to the current environment name.

Usage: ${environment}

distributionName

Will always convert to the current distributionName name.

Usage: ${distributionName}

See examples with variables.

Required: No

parameters

Type: Map<String,Map<String,String>> | Map<String,Map<String,Import>>

Parameters for the init deploy stack, the top level key key is the environment name (dev, stage, prod, etc) or default.

Anything under default will be used only if the parameter is not configured for the current environment.

Under each environment, you can configure a key-value map, where the key is the parameters name.

If your distribution has a dependency on another distribution, then you can import values directly from its output.

Example
initDeployConfig:
  parameters:
    default:
      lambdaRam: 512
      vpcId:
        sourceType: Distribution
        source:
          name: network
          mapping: $.vpc.vpcId
    dev:
      lambdaRam: 1028
    prod:
      lambdaRam: 1540

Required: No

Examples with variables

If I have configured my variables in the attini-config like the example below.

initDeployConfig:
  variables:
    default:
      myConfigDirectory: defaultConfigDirectory
      stackNamePrefix: sandbox
    dev:
      myConfigDirectory: devConfigDirectory
      stackNamePrefix: dev

The following will resolve to a valid AttiniCfn configuration file.

extends: ${myConfigDirectory}/file.yaml
parameters:
  ParameterKey: ParameterValue
tags:
  Key: Value

The following will also be a valid AttiniCfn step.

StepName:
  Type: AttiniCfn
  Properties:
    StackName: ${stackNamePrefix}-hello-world-lambda
    Template: /lambda.yaml

If you want to combine AWS CloudFormation Fn::Sub with Attini variables, the following syntax will work.

StepName:
  Type: AttiniCfn
  Properties:
    StackName:
      Fn::Sub:
        - ${AttiniVariable}-${CloudFormationParameter}-hello-world-lambda
        - AttiniVariable: ${stackNamePrefix}
          CloudFormationParameter: !Ref Parameter # this assumes that there is a CloudFormation Parameter called "Parameter"
    Template: /lambda.yaml