-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_s3_bucket_lifecycle_configuration and two rules with same prefix #23132
Comments
This functionality has been released in v4.1.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Could this be reopened again, please? It's now a problem again with version 4.2.0 of the provider, probably due to the changes in #23252. |
Hi @Tenser, thank you for reaching out. Happy to re-open this if the following suggestion does not prove to be effective. Going by the description provided, it sounds like you are first importing these new resources into terraform state and then performing an update via ** If you have the Based on the aws CLI result (or other information available), map each rule's resource "aws_s3_bucket_lifecycle_configuration" "static" {
bucket = aws_s3_bucket.static.id
rule {
id = "Keep previous version 30 days, then in Glacier another 60"
status = "Enabled"
filter {}
noncurrent_version_transition {
noncurrent_days = 30
storage_class = "GLACIER"
}
noncurrent_version_expiration {
noncurrent_days = 90
}
}
rule {
id = "Delete old incomplete multi-part uploads"
status = "Enabled"
filter {}
abort_incomplete_multipart_upload {
days_after_initiation = 7
}
}
} If instead the rule's resource "aws_s3_bucket_lifecycle_configuration" "static" {
bucket = aws_s3_bucket.static.id
rule {
id = "Keep previous version 30 days, then in Glacier another 60"
status = "Enabled"
filter {
prefix = ""
}
noncurrent_version_transition {
noncurrent_days = 30
storage_class = "GLACIER"
}
noncurrent_version_expiration {
noncurrent_days = 90
}
}
rule {
id = "Delete old incomplete multi-part uploads"
status = "Enabled"
filter {
prefix = ""
}
abort_incomplete_multipart_upload {
days_after_initiation = 7
}
}
} |
The response in the {
"Rules": [
{
"ID": "Keep previous version 30 days, then in Glacier another 60",
"Filter": {
"Prefix": ""
},
"Status": "Enabled",
"NoncurrentVersionTransitions": [
{
"NoncurrentDays": 30,
"StorageClass": "GLACIER"
}
],
"NoncurrentVersionExpiration": {
"NoncurrentDays": 90
}
},
{
"ID": "Delete old incomplete multi-part uploads",
"Filter": {
"Prefix": ""
},
"Status": "Enabled",
"AbortIncompleteMultipartUpload": {
"DaysAfterInitiation": 7
}
}
]
} Adding empty It would seem like the empty |
Hi @Tenzer my understanding from the AWS API is that, in general, the
Since
|
After import, the |
I added another ticket which is kinda a duplicate, #23730 But this one is still Closed and this very much needs fixing, as it's not currently possible in v4 to create both an expiry days and an expiry expired_object_delete_marker without it - which is allowed by the api (and needed to save storage costs) |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Expected Behavior
The two lifecycle rules should continue working as they did in the pre-4.0.0 provider versions.
Actual Behavior
I can import the resource fine, but when I try to apply again, the following error comes up:
Steps to Reproduce
terraform apply
Important Factoids
Putting all the rules inside the same
rule {}
block seems to work, but it makes it more difficult to organise rules that aren't directly related.Looking in the debug log output, I can see the payload being sent to AWS is:
I can see
Prefix
is deprecated according to the documentation, could that be related? https://docs.aws.amazon.com/AmazonS3/latest/API/API_LifecycleRule.html#AmazonS3-Type-LifecycleRule-PrefixReferences
aws_s3_bucket
resource in AWS Provider version 4.0 #23106The text was updated successfully, but these errors were encountered: