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
+10 -3
View File
@@ -7,10 +7,16 @@ resource "aws_s3_bucket" "codebuild-cache" {
resource "aws_s3_bucket" "demo-artifacts" {
bucket = "demo-artifacts-${random_string.random.result}"
# lifecycle moved to aws_s3_bucket_lifecycle_configuration (Change starting from AWS Provider 4.x)
}
lifecycle_rule {
id = "clean-up"
enabled = "true"
resource "aws_s3_bucket_lifecycle_configuration" "demo-artifacts-lifecycle" {
bucket = aws_s3_bucket.demo-artifacts.id
rule {
id = "clean-up"
status = "Enabled"
expiration {
days = 30
@@ -18,6 +24,7 @@ resource "aws_s3_bucket" "demo-artifacts" {
}
}
resource "random_string" "random" {
length = 8
special = false