Skip to content

CICD-235 · Terraform plan generation ​

Encyclopedia · Terraform and infrastructure as code · All snippets

Previous · CICD-234 · Next · CICD-236

1. Where it fits ​

  • Placement In a plan job inside the reviewed Terraform root.
  • Prerequisites trusted Linux runner, Terraform CLI, reviewed IaC and a disposable state for writes.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
terraform init -input=false -lockfile=readonly
terraform plan -input=false -lock-timeout=2m -out=tfplan

3. How it works ​

Terraform initializes the selected backend and saves a binary plan. Treat the saved file as sensitive and bind it to the commit and target state.

4. Verify the result ​

Save a plan tied to the commit and backend. A plan may contain sensitive values and belongs in a restricted store.

Validation syntax-validated (Bash parse). Status definitions.