Skip to main content

Parameters

You use the parameters property to define input parameters for a stack. It's an object of key-value pairs where the keys are parameter names, and the values are configuration for the corresponding parameter values.

The value configuration can be a single static value, an object, or a list of the two types mentioned above. You must use the object configuration when the parameter requires additional configuration, or you want Takomo to resolve its value at deployment time.

Simple static parameters

The simplest way to specify the value for a parameter is to hard code the value to the stack configuration file.

Examples

A single static value for a parameter named VpcId:

parameters:
VpcId: vpc-06e4ab6c6c

A list of values for a parameter named CidrBlocks:

parameters:
CidrBlocks:
- 10.0.0.0/26
- 10.0.0.64/26

Static parameters with object notation

You can provide configuration for static parameters using the object notation which allows you to use additional properties in the configuration. When using the object notation you give the parameter value in value property.

Example

A single static parameter using the object notation:

parameters:
VpcId:
value: vpc-06e4ab6c6c

Immutable parameters

You can mark parameters as immutable if you want to make sure their values are not updated. Many CloudFormation resources have properties that don't support updating after creation, and making them immutable in stack configuration helps prevent failures during deployment.

A parameter can't be marked as immutable if it has NoEcho set to true in the CloudFormation template file. There is no way to find out the current value for NoEcho parameters and therefore Takomo can't detect if their value is about to be changed.

Example

A static immutable value for a parameter named VpcId:

parameters:
VpcId:
value: vpc-06e4ab6c6c
immutable: true

Dynamic parameters

In many cases, it's not wise or even possible to hard code all parameter values. When you need to assign parameter values dynamically at deployment time, you can use parameter resolvers. There are a few built-in parameter resolvers, and you can also implement your own.

You use the resolver property to specify which parameter resolver to use to resolve the value for a parameter.

Below, you can find some examples of built-in parameter resolvers. You can read more about parameter resolvers from here.

Examples

If you have two stacks configured within the same Takomo project, you can use the stack-output resolver to read the first stack's output value and use it as a parameter value in the second stack.

parameters:
VpcId:
resolver: stack-output
stack: /vpc.yml
output: vpcId

If the stacks are not configured within the same Takomo project, you need to use the external-stack-output resolver.

parameters:
VpcId:
resolver: external-stack-output
stack: vpc-stack
output: vpcId
region: eu-west-1
commandRole: arn:aws:iam::123456789012:role/deployer

Where to define

The parameters property can be defined only in stack configuration files.

Requirements

The parameters property must satisfy these requirements:

  • Parameter name must be a string
  • Parameter name must match regex ^[a-zA-Z0-9]*$