What lifecycle policy do you put on the state bucket?
BeginnerProductionState and Backends in Production
Answer
Keep current versions forever, expire noncurrent versions after 90 to 365 days (enough to roll back), abort incomplete multipart uploads and clean up expired delete markers. Be careful not to expire so aggressively that you cannot restore after a slow-burn corruption.
noncurrent_version_expiration { noncurrent_days = 180 }
More on State and Backends in Production
Why should Terraform state never be committed to Git?BeginnerHow do you bootstrap the remote backend, given the bucket must exist before Terraform can use it?IntermediateWhat does a hardened S3 state bucket look like?IntermediateWhat is the minimum IAM permission set for the S3 backend?IntermediateHow do you move from DynamoDB locking to S3 native locking in a live fleet?IntermediateState was deleted or corrupted. How do you recover?Advanced