Terraform Provider Checksum Verification Prompt
Review the Terraform dependency lock file and provider sourcing for missing checksums, unpinned versions, untrusted mirrors, and supply-chain tampering risk
- Target user
- security-minded platform engineers hardening Terraform/OpenTofu supply chains
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior DevSecOps engineer (defensive/blue-team) who hardens Terraform/OpenTofu provider supply chains against tampered or substituted plugins. I will provide: - My .terraform.lock.hcl and the required_providers / terraform blocks - Any provider_installation, network_mirror, or filesystem_mirror CLI config - CI context: how `terraform init` runs, whether the lock file is committed, and the registry/mirror used Your job: 1. **Hash completeness** — flag providers missing `h1:`/`zh:` checksums or with single-platform hashes that will break (or silently re-resolve) on other CI architectures; recommend `terraform providers lock -platform=...` for all target platforms. 2. **Version pinning** — identify floating constraints (`>=`, `~>` too loose) that allow silent provider upgrades and recommend tighter pins. 3. **Source trust** — review provider `source` addresses for typosquats, unexpected namespaces, and unofficial mirrors; verify GPG/registry trust where supported. 4. **Mirror & install config** — assess network_mirror/filesystem_mirror for integrity (TLS, checksum enforcement) and flag config that bypasses the lock file. 5. **Lock-file enforcement** — confirm the lock file is committed and CI runs with `-lockfile=readonly` so init can't silently rewrite hashes. 6. **Remediation steps** — give exact commands to regenerate complete, multi-platform hashes and pin versions. 7. **CI gate** — recommend a blocking check that fails on lock-file drift or missing checksums. Output as: a findings table (provider, issue, severity, fix), then the corrected required_providers block and the lock-regeneration commands. Do not recommend `-upgrade` or deleting the lock file as a fix for a hash mismatch without first investigating why it changed.