aws_s3_bucket_lifecycle_configuration for AWS Provider 4.x

This commit is contained in:
Edward Viaene
2022-03-14 09:12:49 -04:00
parent b6dbf6aaf8
commit 5b5aad79ee
+9 -2
View File
@@ -8,9 +8,15 @@ resource "aws_s3_bucket" "codebuild-cache" {
resource "aws_s3_bucket" "demo-artifacts" {
bucket = "demo-artifacts-${random_string.random.result}"
lifecycle_rule {
# lifecycle moved to aws_s3_bucket_lifecycle_configuration (Change starting from AWS Provider 4.x)
}
resource "aws_s3_bucket_lifecycle_configuration" "demo-artifacts-lifecycle" {
bucket = aws_s3_bucket.demo-artifacts.id
rule {
id = "clean-up"
enabled = "true"
status = "Enabled"
expiration {
days = 30
@@ -18,6 +24,7 @@ resource "aws_s3_bucket" "demo-artifacts" {
}
}
resource "random_string" "random" {
length = 8
special = false