Closed as duplicate of#34645
Description
Terraform and AWS Provider Version
Terraform v1.11.4
on darwin_arm64
Affected Resource(s) or Data Source(s)
aws_s3_bucket_lifecycle_configuration
Expected Behavior
I added new rule, TF should just create it.
Actual Behavior
I added new rule, but TF recreates the existing one.
Relevant Error/Panic Output
# module.private-cloud.aws_s3_bucket_lifecycle_configuration.iguides-s3 will be updated in-place
...
~ rule {
~ id = "draft-queue" -> "delete-stitch-data/-1year"
# (2 unchanged attributes hidden)
~ expiration {
~ days = 30 -> 365
# (1 unchanged attribute hidden)
}
~ filter {
~ prefix = "draft-queue/" -> "stitch-data/"
}
}
...
+ rule {
+ id = "draft-queue"
+ status = "Enabled"
# (1 unchanged attribute hidden)
+ expiration {
+ days = 30
+ expired_object_delete_marker = false
}
+ filter {
+ prefix = "draft-queue/"
}
}
Sample Terraform Configuration
Click to expand configuration
resource "aws_s3_bucket_lifecycle_configuration" "iguides-s3" {
bucket = aws_s3_bucket.iguides-s3.id
# Delete stitch data after 1 year
rule {
id = "delete-stitch-data/-1year"
status = "Enabled"
filter {
prefix = "stitch-data/"
}
expiration {
days = 365
expired_object_delete_marker = false
}
}
# Delete draft-queue/ after 30 days
rule {
id = "draft-queue"
status = "Enabled"
filter {
prefix = "draft-queue/"
}
expiration {
days = 30
}
}
}
+ # Delete stitch data after 1 year
+ rule {
+ id = "delete-stitch-data/-1year"
+ status = "Enabled"
+
+ filter {
+ prefix = "stitch-data/"
+ }
+
+ expiration {
+ days = 365
+ expired_object_delete_marker = false
+ }
+ }
Steps to Reproduce
- Create lyfecycle with one rule
- plan/apply
- Add another rule before the first one
- plan/apply
TF will replace the first rule, though it should just add the new one.
Debug Logging
Click to expand log output
GenAI / LLM Assisted Development
n/a
Important Facts and References
Probably this belongs to:
#42202
There also array of some items and how TF works with them.
Would you like to implement a fix?
No