-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: aws_s3_bucket_lifecycle_configuration should honor the new explicit x-amz-transition-default-minimum-object-size #41073
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This functionality has been released in v5.86.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! |
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. |
Terraform Core Version
1.10.2
AWS Provider Version
5.84.0
Affected Resource(s)
In September 2024 Amazon S3 updated the default transition behavior for small objects. Full details can be found here
Summary of changes:
transition_default_minimum_object_size
=varies_by_storage_class
Two scenario where the current implementation could cause unintended results.
Scenario 1 - explicit attribute declaration followed by absent of attribute
Suppose that user intentionally set
transition_default_minimum_object_size
=varies_by_storage_class
during initial apply:and then decided that they do not want to set this attribute anymore. In this case, user assumes that new behavior will take precendence when attribute
transition_default_minimum_object_size
was not explicitly set.In this scenario, Terraform will ignore the changes and keep the old behavior.
Even if user made changes to other attributes, Terraform will continue to honor the old value for
transition_default_minimum_object_size
="varies_by_storage_class"
For example, if user change the transition rule from 30 to 60 days:
My concern is that this behavior is not exactly match what is documented in S3 documentation here:
Scenario 2 - provider upgrade can introduce unintended old behavior
Suppose that user previously set lifecycle configuration prior to Sept 2024. Notice that
transition_default_minimum_object_size
does not existed at the time.Then user upgraded the provider and made minor change to the configuration (modify transition day from 30 -> 60). Notice that
transition_default_minimum_object_size
still is not explicitly added to the configuration:During terraform plan / apply, interesting sequence of API response can be observed as follow:
transition_default_minimum_object_size
="varies_by_storage_class"
transition_default_minimum_object_size
="varies_by_storage_class"
As the result, user might trigger transition of object smaller than 128 KB unknowingly.
Proposal
We could explicitly set default value in the schema, so that when
transition_default_minimum_object_size
is not specified, it will always default toall_storage_classes_128K
.References
S3 documentation: https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html#lifecycle-configuration-constraints
Example S3 GetBucketLifecycleConfiguration from bucket created pre Sept 2024:
Expected Behavior
aws_s3_bucket_lifecycle_configuration
should default to set attributetransition_default_minimum_object_size
toall_storage_classes_128K
when it's not explicitly specified.Actual Behavior
aws_s3_bucket_lifecycle_configuration
will set attributetransition_default_minimum_object_size
based on the returned response from S3 API.Relevant Error/Panic Output Snippet
Terraform Configuration Files
see description
Steps to Reproduce
see description
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: