我正在Terraform中工作,正在创建一个S3对象/具有内容的文件夹。我想从我的生命周期策略中排除该对象。但是我不确定从生命周期策略(下面的Terraform代码)中排除对象(文件夹对象/样本):
resource "aws_s3_bucket" "s3_test" {
bucket = "test-bucket-upload"
acl = "private"
key = "folder-object/sample"
tags {
Name = "test-bucket"
Environment = "lab"
}
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
lifecycle_rule {
id = "glacier-transfer"
enabled = true
transition {
days = 360
storage_class = "GLACIER"
}
}
}
答案 0 :(得分:0)
使用前缀来标识您的生命周期规则应适用的对象,而不是排除。例如,以下规则仅适用于存储桶中new_objects文件夹中的对象:
...
lifecycle_rule {
id = "glacier-transfer"
enabled = true
prefix = "new_objects/"
transition {
days = 360
storage_class = "GLACIER"
}
}
...