Home / Market / terraform provider lock platform audit

terraform provider lock platform audit

Audit .terraform.lock.hcl files and multi-platform CI matrices offline with pinned Terraform providers lock and synthetic filesystem mirrors across checksums and trust limits.

skill★ 509080 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: terraform-provider-lock-platform-audit description: "Audit .terraform.lock.hcl files and multi-platform CI matrices offline with pinned Terraform providers lock and synthetic filesystem mirrors across checksums and trust limits." category: devops risk: safe source: self source_type: self date_added: "2026-12-01" author: Koushik-Katkam tags: [terraform, lockfile, providers, multi-platform, checksums, audit]

---

Terraform Provider Lock Platform Audit

Overview

Audit Terraform .terraform.lock.hcl dependency lock files and CI platform matrices (linux_amd64, windows_amd64, darwin_arm64) offline using the real terraform providers lock -fs-mirror=... command in isolated temporary directories (Terraform v1.17.2) against local/synthetic filesystem provider mirrors. Verifies required provider source addresses and pinned versions, mirror package availability across every target platform, lockfile h1: hash integrity against mirror packages, missing platform failures, and altered package checksum mismatches — while never running terraform apply, executing provider binaries, or accessing remote state.

Distinction from existing IaC skills:

When to Use

Prerequisites

How It Works

1. Audit declared providers vs. lockfile entries and platform limitations

  1. Parse .terraform.lock.hcl using a structured lark HCL lockfile grammar (handling #, //, and /* ... */ comments cleanly and rejecting malformed/trailing HCL tokens as INVALID_INPUT) combined with Terraform-native lockfile validation.
  2. Validate non-empty explicit platforms, required_providers source addresses/versions, and synthetic configuration scope (rejecting module blocks). Every required provider must exist in .terraform.lock.hcl with matching version and non-empty hashes (MISSING_LOCK_PROVIDER / VERSION_MISMATCH / EMPTY_LOCK_HASHES).
  3. Enforce the lockfile platform-identity limit: .terraform.lock.hcl stores an unlabeled hashes = ["h1:...", ...] list; reading .terraform.lock.hcl alone cannot determine which h1: belongs to linux_amd64 vs. darwin_arm64 — real multi-platform -platform=... verification against mirror packages is mandatory.

2. Exercise real terraform providers lock -fs-mirror=... in isolated temp workspaces

Run the local verification suite in Terraform lockfile platform audit harness:

  1. Multi-platform lock generation & parity check: Copy the trusted synthetic versions.tf and candidate .terraform.lock.hcl into isolated temporary directories (stripped TF_* environment, local.tfrc disabling checkpoint calls), execute terraform providers lock -no-color -fs-mirror=<mirror> -platform=<p1> ... (30s timeout), verify the generated provider set matches required_providers (GENERATED_PROVIDER_MISMATCH), require non-empty generated hashes, and compare the generated h1: hash set against the candidate lockfile.
  2. Missing CI platform package: Omit one required platform (darwin_arm64) from the filesystem mirror and confirm terraform providers lock exits non-zero (MISSING_PLATFORM_PACKAGE).
  3. Altered mirror archive / checksum mismatch: Modify a mirror provider .zip after baseline lock generation and verify terraform providers lock yields a new h1: hash set diverging from the baseline lockfile (CHECKSUM_MISMATCH).
  4. Trust boundary separation: Report (unauthenticated) mirror retrievals explicitly: local -fs-mirror checksum verification proves byte consistency between mirror archives and .terraform.lock.hcl (package_integrity), never upstream GPG signature trust or publisher provenance (upstream_trust_unverified).

Examples

Run the self-contained verification suite in Terraform lockfile platform audit harness:

User request: "Verify our .terraform.lock.hcl matches our mirror packages across linux_amd64, darwin_arm64, and windows_amd64."
Inputs: versions.tf, .terraform.lock.hcl, CI platform list, and local -fs-mirror directory run under Terraform v1.17.2.
Expected result: Clean 3-platform lockfile matches recomputed h1: hashes with PASS + unauthenticated-mirror caveat;
  missing platform package fails terraform providers lock; altered mirror zip triggers CHECKSUM_MISMATCH;
  missing lock provider/malformed HCL returns FAIL/INVALID_INPUT.

Limitations

Safety and Side Effects

Sources and related skills