Tfvars & Layering

Note: Premium video content requires a subscription.

Terraspace supports looking up tfvar files in conventional locations. This encourages an organized structure.

Tfvars Structure

Tfvar files should be place within the config/stacks/MOD/tfvars folder. Example:

config/stacks/demo
└── tfvars
    ├── base.tfvars
    ├── dev.tfvars
    └── prod.tfvars

You don’t have to specify the -var-file option, the tfvars files are automatically processed and used via layering.

Layering

The the tfvar files are processed and “layered”. Example:

TS_ENV=dev  terraspace up demo -y # merges base and dev
TS_ENV=prod terraspace up demo -y # merges base and prod

Tfvars Layering Docs

Seed Command

The terraspace seed command creates starter tfvars files for you. Examples:

$ terraspace seed network
      create  config/stacks/network/tfvars/dev.tfvars
$ TS_ENV=prod terraspace seed network
      create  config/stacks/network/tfvars/prod.tfvars
$

Tfvars Seed Docs.

More tools: