mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 03:01:53 +03:00
aws_s3_bucket_lifecycle_configuration for AWS Provider 4.x
This commit is contained in:
+10
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user