CI Perf Lint

terraform-lockfile-missing

What it flags

Terraform root modules initialized in CI without their own .terraform.lock.hcl. Step/job/workflow working-directory defaults, static cd, and terraform -chdir are considered. A lockfile in another module does not suppress the finding.

Why it matters

Without a lock file, Terraform resolves provider versions at terraform init time, which means:

  1. Run terraform init locally to generate .terraform.lock.hcl
  2. Commit the lock file
  3. Add the lock file to the Terraform provider cache key
- uses: actions/cache@v4
  with:
    path: ~/.terraform.d/plugin-cache
    key: terraform-${{ runner.os }}-${{ hashFiles('**/.terraform.lock.hcl') }}

Caveats