Terraform Apply
Overview
Apply Terraform changes in a controlled, repeatable way after configuration updates, capturing plan/apply results for the task.
Workflow
Identify the Terraform root
- Locate the directory with the root module (typically contains
main.tfand/or backend/provider blocks). - If multiple roots exist, apply only the one(s) touched by the update.
- Locate the directory with the root module (typically contains
Prepare the workspace
- Ensure required credentials, environment variables, and backend config are available.
- Run
terraform init(use-upgradeonly if module/provider versions changed). - Run
terraform validateand stop on errors.
Plan the change
- Run
terraform plan -out=tfplanand review for unexpected changes. - If the plan is empty, note it and stop without applying.
- Run
Apply the change
- Run
terraform apply tfplanto apply the reviewed plan. - Use
-auto-approveonly when a non-interactive apply is explicitly required.
- Run
Capture results
- Save key plan/apply output details in the task (resource changes, outputs, or any manual follow-ups).
- If apply fails, stop and surface the error immediately.
Source: Day-in-the-Country-LLC/appforge-poc — distributed by TomeVault.