Terraform runs
A Terraform run provisions infrastructure from a working directory of .tf files. The run's command
names that directory, relative to the project checkout.
What runs
terraform init runs first. If it fails the run stops there with init's result. Then terraform apply -auto-approve applies the configuration. A dry run runs terraform plan instead, so it
previews the change without touching infrastructure. All three run with -input=false -no-color, so
a run never blocks on a prompt.
How values reach the configuration
- Extra vars, including survey answers and template vars, arrive as
TF_VAR_environment entries, so a variable namedregionbecomesTF_VAR_region. Scalars pass through as strings, lists and maps pass as JSON, which Terraform accepts. - Credentials arrive in the environment, so an
envcredential of cloud keys or atokencredential asYARDMASTER_TOKENauthenticates the provider. A command-source credential resolves fresh each run. - The command directory cannot escape the project with
.., so a run stays inside its checkout.
Example
A directory infra/network holding:
variable "region" { type = string }
output "vpc" { value = "vpc-${var.region}" }
Launch a Terraform run with the command set to infra/network and a survey field region. A dry run
shows the plan. A real run applies it.
See also Bash runs, Python runs, Go runs, and the tutorials.
