Skip to content

CICD-232 · Terraform initialization ​

Encyclopedia · Terraform and infrastructure as code · All snippets

Previous · CICD-231 · Next · CICD-233

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

3. How it works ​

Initialization prepares the working directory and installs locked providers. Backend flags decide whether state is contacted.

4. Verify the result ​

Run from the IaC root with a committed .terraform.lock.hcl. Static checks install providers without connecting to state.

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