Along with any variables you may define, Stacks also injects a number of read-only variables for you to use in Jinja and/or Terraform.
Here's a full list of all special variables:
The path of the current running layer, relative to the stacks directory parent.
Example: stacks/vpc/layers/production
.
The path of the stacks directory parent, relative to Terraform's runtime working directory.
Similar to Terraform's ${path.root}
, so you can reference other files relative to the root of the repository.
Example: ../../../../..
.
The name of the stack.
Example: vpc
.
The full (directory) name of the layer.
Example: production@us-east-1_foo
.
The name of the environment.
Example: production
.
The name of the subenvironment, if applicable, otherwise it's ""
(empty string).
Example: us-east-1
.
The name of the instance, if applicable, otherwise it's ""
(empty string).
Example: foo
.
A map of all environments and their settings. Example:
{
production = {
production = true
aws_region = "eu-south-2"
aws_assume_role = "Admin"
}
development = {
production = false
aws_region = "eu-south-2"
aws_assume_role = "Developer"
}
}