CICD-234 · Terraform configuration validation
Encyclopedia · Terraform and infrastructure as code · All snippets
Previous · CICD-233 · Next · CICD-235
1. Where it fits
- Placement CI run step.
- 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 -backend=false -input=false -lockfile=readonly
terraform validate -no-color3. How it works
Initialization prepares the working directory and installs locked providers. Backend flags decide whether state is contacted. Validation checks initialized configuration for structural and type errors.
4. Verify the result
Validate initialized configuration before preparing credentials or remote state.
Validation syntax-validated (Bash parse). Status definitions.