I am using terraform version 0.14 and AWS provider 4.0.0
I am trying to add two lifecycle rules to the same bucket. My terraform code is:
resource "aws_s3_bucket_lifecycle_configuration" "testing_lifecycle_1" {
bucket = aws_s3_bucket.testing.id
rule {
id = "delete_old_versions"
prefix = ""
expiration {
expired_object_delete_marker = true
}
noncurrent_version_expiration {
noncurrent_days = 1
}
status = "Enabled"
}
}
resource "aws_s3_bucket_lifecycle_configuration" "testing_lifecycle_2" {
bucket = aws_s3_bucket.testing.id
rule {
id = "delete_old_inventory"
prefix = "inventory/"
expiration {
days = 7
}
status = "Enabled"
}
}
When i try and apply this, testing_lifecycle_1 gets created but if can't create testing_lifecycle_2, it will timeout trying to create it. I get the following error message
Error: error waiting for S3 Lifecycle Configuration for bucket (NAME_OF_BUCKET) to reach expected rules status after update: timeout while waiting for state to become 'READY' (last state: 'NOT_READY', timeout: 3m0s)
I've looked into increasing timeout but that timeout function isn't supported for this resource. But it shouldn't be taking over 3 minutes to make the 2nd rule anyway
Anyone come across this before?
As per the documentation:
S3 Buckets only support a single lifecycle configuration. Declaring multiple aws_s3_bucket_lifecycle_configuration resources to the same S3 Bucket will cause a perpetual difference in configuration.