You must be logged in to view saved presets
This template configures an S3 bucket and object with object locking enabled, setting legal hold and retention policies.
resource "aws_s3_bucket" "examplebucket" {
bucket = "examplebuckettftest"
object_lock_enabled = true
}
resource "aws_s3_bucket_acl" "example" {
acl = "private"
bucket = aws_s3_bucket.examplebucket.id
}
resource "aws_s3_bucket_versioning" "example" {
bucket = aws_s3_bucket.examplebucket.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_object" "examplebucket_object" {
bucket = aws_s3_bucket.examplebucket.id
depends_on = ["aws_s3_bucket_versioning.example"]
force_destroy = true
key = "someobject"
object_lock_legal_hold_status = "ON"
object_lock_mode = "GOVERNANCE"
object_lock_retain_until_date = "2021-12-31T23:59:60Z"
source = "important.txt"
}