The repository is only one part of the picture
A clean Terraform repository does not by itself guarantee that infrastructure data is protected. State connects configuration to real resources, and saved plans can contain information that needs the same care as deployment credentials.
During a project handoff, map where these files live, which identities can read them, and where copies might be created. Include developer machines, CI artifacts, backup systems, and debugging attachments.
Sensitive output is not the same as secret storage
The sensitive flag suppresses a value in normal CLI output, but it does not remove that value from state or saved plan files. Do not treat it as encryption or an access-control mechanism.
Use a remote backend with appropriate storage protections and restricted access. Backend capabilities vary, so verify the encryption, versioning, and locking behavior of the backend you actually use. Avoid checking state or plan files into version control.
Separate the permissions people actually need
Plan the read and write boundaries before giving a shared automation identity access to every environment. Production state should have a deliberate access policy rather than inherit convenience permissions from development.
Document who can run a plan, who can approve it, and which identity applies it. Tie a production apply to the reviewed configuration and inspect the plan for destructive or unexpected changes. Keep retained CI artifacts private and give them a clear retention period.
Rehearse recovery before you need it
A state backup is only useful if the team knows how to use it without losing track of real resources. Write a recovery procedure and validate it against disposable infrastructure. Establish who investigates a failed operation and how concurrent changes are paused.
Avoid treating direct state edits as routine cleanup. First understand the difference between configuration, state, and the real environment, then choose the smallest documented operation that brings them back into agreement.
- State and plans are excluded from version control.
- Backend access is limited by environment and responsibility.
- Concurrent operations are controlled using supported backend features.
- Backups and recovery steps have been checked in a disposable environment.
Further reading
Project references and official documentation for further reading: