Dev.to
7/20/2026

The original title is "State Encryption in OpenTofu: How It Works and How to Roll It Out"
Original: State Encryption in OpenTofu: How It Works and How to Roll It Out
Short summary
OpenTofu's native state and plan encryption encrypts infrastructure state at the data layer before it hits any backend or local file, solving the problem of secrets leaking in plaintext JSON. The article walks through configuring PBKDF2 passphrase-based encryption for solo projects and AWS KMS-backed encryption for production, with concrete HCL examples. Key operational caveats around passphrase management and early evaluation order are covered.
- •OpenTofu encrypts state and plans at the data layer, unlike upstream Terraform
- •PBKDF2 passphrase provider is easy but risky for shared/production setups
- •KMS-backed encryption provides IAM access control and audit logging for free
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



