July 2017
Beginner
208 pages
5h 10m
English
When running Terraform commands, you can optionally supply a variable file via the -var-file argument. The syntax of these files is the good old HCL, familiar to you from Terraform templates themselves. Create a new file named development.tfvars and set your variables there:
region = "eu-central-1"
vpc_cidr = "172.0.0.0/16"
subnet_cidrs = {
public = "172.0.16.0/24"
private = "172.0.17.0/24"
}
To use it, run terraform plan command with -var-file argument:
$> terraform plan -var-file=./development.tfvars
It's much more reliable to use variable files for production stacks: you always know which values are there and you can store them in version control. And for sensitive things, such as a personal password to access ...
Read now
Unlock full access