Terraform state stored in a public or unencrypted bucket
The Terraform state file records your infrastructure — and often resolved secrets (passwords, keys) in plaintext. Storing it in a public, unencrypted or unversioned bucket exposes all of that.
Why it matters
A readable state file hands an attacker a map of your environment and, frequently, live credentials.
No versioning or locking also risks corruption and lost history, which turns a small mistake into an outage.
How to check for it
- Check the backend bucket (S3/GCS/Azure) for public access, encryption, versioning and a lock table (DynamoDB for S3).
- Confirm only the CI role and a few humans can read the state bucket.
How to fix it
- Use a private, encrypted, versioned backend with state locking, and restrict access to the pipeline identity.
- Rotate any secret that was ever present in an exposed state file.
SkyShield checks this automatically
Connect your AWS, Cloudflare, GitHub, GitLab, Hetzner or DigitalOcean account read-only and SkyShield flags this across every account and region, with the fix in plain words — alongside the agent that watches your servers. Start free.
FAQ
- How do I keep secrets out of state entirely?
- You can't fully — Terraform records resolved values — so the real control is protecting the backend and rotating anything that leaks.