Terraform – Workflow
- Core workflow: Write → Plan → Apply
- Write – define resources in
.tf files
- Plan – Terraform computes the diff between current state
and desired state
- Apply – Terraform executes the changes; can generate
incremental execution plans
- Key commands
# initialise working directory, download providers
$ terraform init
# show what changes will be made (dry run)
$ terraform plan
# apply the changes to real infrastructure
$ terraform apply
# destroy all managed resources
$ terraform destroy
State management
- State stored locally in
terraform.tfstate by default