Terraform & Helm: Terraform: everyday workflow
8 Terraform & Helm commands: Terraform: everyday workflow. Click a command to see what each part does.
Terraform & Helm: Terraform: everyday workflowIndex
Terraform: everyday workflow8
terraform init -upgradeInitialise and upgrade providersWhat each part does
initdownload providers/modules and configure the backend-upgradepick the newest versions allowed by the constraints
terraform fmt -recursive -check && terraform validateFormat and validateWhat each part does
fmt -recursiveformat .tf files in sub-folders too-checkdon't change files; exit non-zero if formatting is needed (CI)validatecheck syntax and internal consistency (no API calls)
terraform plan -var-file=<env>.tfvars -out=tfplanPlan with a var file and save the planWhat each part does
plancompute what would change-var-file=<env>.tfvarsload variable values from a file (repeatable)-out=tfplansave this exact plan to apply later (contains values in clear text: keep it private)
terraform apply tfplanApply exactly the reviewed planCautionWhat each part does
apply tfplanapply the saved plan with no re-planning and no prompt
terraform plan -input=false -no-color -detailed-exitcode -out=tfplanCI-friendly plan: did anything change?What each part does
-input=falsenever prompt for variables-no-colorplain output for logs-detailed-exitcodeexit 0 = no changes, 1 = error, 2 = changes present
terraform plan -target=<address> -out=tfplanPlan only one resource (exceptional cases)What each part does
-target=<address>limit to that resource and its dependencies (use sparingly)
terraform plan -replace=<address> -out=tfplanForce replacement of one resourceCautionWhat each part does
-replace=<address>plan to destroy and recreate it (successor of taint)
terraform -chdir=<dir> planRun in another folder without cdWhat each part does
-chdir=<dir>global option, goes before the subcommand
Nothing matches.
My DevOps Playbook by Angelo John Calleja