Skill 2.4.3
Protecting and sharing state
Key Concepts
Every attribute of a resource is stored in state, including database passwords, private keys and tokens, in plain text. Marking a variable or output sensitive only hides it in CLI output. Treat state as sensitive data: never commit it to version control, store it in a backend that encrypts it at rest and in transit, and restrict who can read it. Ephemeral values and write-only arguments keep secrets out of state altogether.
A remote backend, such as Amazon S3 or HCP Terraform, stores state where the whole team and automation can reach it, locks it during operations and often keeps versions for recovery. Local state on one laptop cannot be shared safely and is lost if the laptop is.