mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 07:01:56 +03:00
aws_s3_bucket_lifecycle_configuration for AWS Provider 4.x
This commit is contained in:
@@ -8,9 +8,15 @@ resource "aws_s3_bucket" "codebuild-cache" {
|
|||||||
resource "aws_s3_bucket" "demo-artifacts" {
|
resource "aws_s3_bucket" "demo-artifacts" {
|
||||||
bucket = "demo-artifacts-${random_string.random.result}"
|
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"
|
id = "clean-up"
|
||||||
enabled = "true"
|
status = "Enabled"
|
||||||
|
|
||||||
expiration {
|
expiration {
|
||||||
days = 30
|
days = 30
|
||||||
@@ -18,6 +24,7 @@ resource "aws_s3_bucket" "demo-artifacts" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "random_string" "random" {
|
resource "random_string" "random" {
|
||||||
length = 8
|
length = 8
|
||||||
special = false
|
special = false
|
||||||
|
|||||||
Reference in New Issue
Block a user