← Terraform & Infrastructure as Code learning pathTerraform & Infrastructure as Code · Module 3 of 10
Variables, outputs and locals
Make configurations reusable.
📖 Key ideas
- Input variables: variable "region" { default = "ap-south-1" }.
- Set values with terraform.tfvars, -var, or environment variables (TF_VAR_name).
- Outputs show values after apply: output "url" { value = ... }.
- Locals hold computed values for reuse.
- Mark secrets as sensitive = true.
💡 Real-life example: Variables are blanks in a form; outputs are the receipt you get after submitting.
VariableInput parameter
OutputValue shown after apply
LocalNamed computed value
tfvarsFile setting variable values