Prompt
Do I need a secrets manager for Terraform state?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Usually yes, you should treat Terraform state as sensitive, but you don’t always need a separate secrets manager just for state.
Why
Terraform state can contain:
- resource IDs and metadata
- provider config details
- sensitive values if they’re used in resources or outputs
- sometimes credentials, depending on how you write/configure things
So the key question is: where is your state stored, and who can access it?
Common practice
For most teams, the baseline is:
- store state in a remote backend with encryption at rest
- restrict access tightly with IAM/RBAC
- enable audit logging/versioning where possible
- avoid putting secrets directly into Terraform variables/resources unless necessary
When a secrets manager is useful
Use a secrets manager if you need to:
- inject secrets into Terraform without hardcoding them
- keep secrets out of state entirely
- manage sensitive runtime credentials separately from infrastructure config
Examples:
- AWS Secrets Manager
- HashiCorp Vault
- Azure Key Vault
- GCP Secret Manager
Important nuance
A secrets manager does not automatically solve Terraform state secrecy. If Terraform reads a secret and uses it in a resource, that secret may still end up in state depending on the provider/resource.
Rule of thumb
- For state storage: use a secure remote backend, not a secrets manager.
- For secret values: use a secrets manager if you need to manage or reference sensitive data safely.
Practical recommendation
If you’re using Terraform in production:
- Put state in a remote backend with encryption and access controls.
- Don’t commit state locally or to Git.
- Use a secrets manager for application/credential secrets.
- Check whether the specific resources you manage will store secrets in state.
If you want, I can help you figure out this for your setup specifically (e.g. AWS S3 + DynamoDB, Terraform Cloud, Azure, GCP, etc.).