Skip to content

Latest commit

 

History

History
52 lines (42 loc) · 1.38 KB

3.5. Special variables.md

File metadata and controls

52 lines (42 loc) · 1.38 KB

Special variables

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:

var.stacks_path

The path of the current running layer, relative to the stacks directory parent. Example: stacks/vpc/layers/production.

var.stacks_root

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: ../../../../...

var.stacks_stack

The name of the stack. Example: vpc.

var.stacks_layer

The full (directory) name of the layer. Example: production@us-east-1_foo.

var.stacks_environment

The name of the environment. Example: production.

var.stacks_subenvironment

The name of the subenvironment, if applicable, otherwise it's "" (empty string). Example: us-east-1.

var.stacks_instance

The name of the instance, if applicable, otherwise it's "" (empty string). Example: foo.

var.stacks_environments

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"
	}
}