Skip to content

feat: add transition_default_minimum_object_size #274

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ Available targets:
| <a name="input_lifecycle_configuration_rules"></a> [lifecycle\_configuration\_rules](#input\_lifecycle\_configuration\_rules) | A list of lifecycle V2 rules | <pre>list(object({<br/> enabled = optional(bool, true)<br/> id = string<br/><br/> abort_incomplete_multipart_upload_days = optional(number)<br/><br/> # `filter_and` is the `and` configuration block inside the `filter` configuration.<br/> # This is the only place you should specify a prefix.<br/> filter_and = optional(object({<br/> object_size_greater_than = optional(number) # integer >= 0<br/> object_size_less_than = optional(number) # integer >= 1<br/> prefix = optional(string)<br/> tags = optional(map(string), {})<br/> }))<br/> expiration = optional(object({<br/> date = optional(string) # string, RFC3339 time format, GMT<br/> days = optional(number) # integer > 0<br/> expired_object_delete_marker = optional(bool)<br/> }))<br/> noncurrent_version_expiration = optional(object({<br/> newer_noncurrent_versions = optional(number) # integer > 0<br/> noncurrent_days = optional(number) # integer >= 0<br/> }))<br/> transition = optional(list(object({<br/> date = optional(string) # string, RFC3339 time format, GMT<br/> days = optional(number) # integer > 0<br/> storage_class = optional(string)<br/> # string/enum, one of GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.<br/> })), [])<br/><br/> noncurrent_version_transition = optional(list(object({<br/> newer_noncurrent_versions = optional(number) # integer >= 0<br/> noncurrent_days = optional(number) # integer >= 0<br/> storage_class = optional(string)<br/> # string/enum, one of GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.<br/> })), [])<br/> }))</pre> | `[]` | no |
| <a name="input_lifecycle_rule_ids"></a> [lifecycle\_rule\_ids](#input\_lifecycle\_rule\_ids) | DEPRECATED (use `lifecycle_configuration_rules`): A list of IDs to assign to corresponding `lifecycle_rules` | `list(string)` | `[]` | no |
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_rules) | DEPRECATED (`use lifecycle_configuration_rules`): A list of lifecycle rules | <pre>list(object({<br/> prefix = string<br/> enabled = bool<br/> tags = map(string)<br/><br/> enable_glacier_transition = bool<br/> enable_deeparchive_transition = bool<br/> enable_standard_ia_transition = bool<br/> enable_current_object_expiration = bool<br/> enable_noncurrent_version_expiration = bool<br/><br/> abort_incomplete_multipart_upload_days = number<br/> noncurrent_version_glacier_transition_days = number<br/> noncurrent_version_deeparchive_transition_days = number<br/> noncurrent_version_expiration_days = number<br/><br/> standard_transition_days = number<br/> glacier_transition_days = number<br/> deeparchive_transition_days = number<br/> expiration_days = number<br/> }))</pre> | `null` | no |
| <a name="input_lifecycle_transition_default_minimum_object_size"></a> [lifecycle\_transition\_default\_minimum\_object\_size](#input\_lifecycle\_transition\_default\_minimum\_object\_size) | Specifies the default minimum object size behavior applied to the lifecycle configuration.<br/>Valid values are `all_storage_classes_128K`(default) and `varies_by_storage_class`. | `string` | `"all_storage_classes_128K"` | no |
| <a name="input_logging"></a> [logging](#input\_logging) | Bucket access logging configuration. Empty list for no logging, list of 1 to enable logging. | <pre>list(object({<br/> bucket_name = string<br/> prefix = string<br/> }))</pre> | `[]` | no |
| <a name="input_minimum_tls_version"></a> [minimum\_tls\_version](#input\_minimum\_tls\_version) | Set the minimum TLS version for in-transit traffic | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br/>This is the only ID element not also included as a `tag`.<br/>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
| <a name="input_lifecycle_configuration_rules"></a> [lifecycle\_configuration\_rules](#input\_lifecycle\_configuration\_rules) | A list of lifecycle V2 rules | <pre>list(object({<br/> enabled = optional(bool, true)<br/> id = string<br/><br/> abort_incomplete_multipart_upload_days = optional(number)<br/><br/> # `filter_and` is the `and` configuration block inside the `filter` configuration.<br/> # This is the only place you should specify a prefix.<br/> filter_and = optional(object({<br/> object_size_greater_than = optional(number) # integer >= 0<br/> object_size_less_than = optional(number) # integer >= 1<br/> prefix = optional(string)<br/> tags = optional(map(string), {})<br/> }))<br/> expiration = optional(object({<br/> date = optional(string) # string, RFC3339 time format, GMT<br/> days = optional(number) # integer > 0<br/> expired_object_delete_marker = optional(bool)<br/> }))<br/> noncurrent_version_expiration = optional(object({<br/> newer_noncurrent_versions = optional(number) # integer > 0<br/> noncurrent_days = optional(number) # integer >= 0<br/> }))<br/> transition = optional(list(object({<br/> date = optional(string) # string, RFC3339 time format, GMT<br/> days = optional(number) # integer > 0<br/> storage_class = optional(string)<br/> # string/enum, one of GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.<br/> })), [])<br/><br/> noncurrent_version_transition = optional(list(object({<br/> newer_noncurrent_versions = optional(number) # integer >= 0<br/> noncurrent_days = optional(number) # integer >= 0<br/> storage_class = optional(string)<br/> # string/enum, one of GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE, GLACIER_IR.<br/> })), [])<br/> }))</pre> | `[]` | no |
| <a name="input_lifecycle_rule_ids"></a> [lifecycle\_rule\_ids](#input\_lifecycle\_rule\_ids) | DEPRECATED (use `lifecycle_configuration_rules`): A list of IDs to assign to corresponding `lifecycle_rules` | `list(string)` | `[]` | no |
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_rules) | DEPRECATED (`use lifecycle_configuration_rules`): A list of lifecycle rules | <pre>list(object({<br/> prefix = string<br/> enabled = bool<br/> tags = map(string)<br/><br/> enable_glacier_transition = bool<br/> enable_deeparchive_transition = bool<br/> enable_standard_ia_transition = bool<br/> enable_current_object_expiration = bool<br/> enable_noncurrent_version_expiration = bool<br/><br/> abort_incomplete_multipart_upload_days = number<br/> noncurrent_version_glacier_transition_days = number<br/> noncurrent_version_deeparchive_transition_days = number<br/> noncurrent_version_expiration_days = number<br/><br/> standard_transition_days = number<br/> glacier_transition_days = number<br/> deeparchive_transition_days = number<br/> expiration_days = number<br/> }))</pre> | `null` | no |
| <a name="input_lifecycle_transition_default_minimum_object_size"></a> [lifecycle\_transition\_default\_minimum\_object\_size](#input\_lifecycle\_transition\_default\_minimum\_object\_size) | Specifies the default minimum object size behavior applied to the lifecycle configuration.<br/>Valid values are `all_storage_classes_128K`(default) and `varies_by_storage_class`. | `string` | `"all_storage_classes_128K"` | no |
| <a name="input_logging"></a> [logging](#input\_logging) | Bucket access logging configuration. Empty list for no logging, list of 1 to enable logging. | <pre>list(object({<br/> bucket_name = string<br/> prefix = string<br/> }))</pre> | `[]` | no |
| <a name="input_minimum_tls_version"></a> [minimum\_tls\_version](#input\_minimum\_tls\_version) | Set the minimum TLS version for in-transit traffic | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br/>This is the only ID element not also included as a `tag`.<br/>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
Expand Down
5 changes: 3 additions & 2 deletions lifecycle.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ locals {


resource "aws_s3_bucket_lifecycle_configuration" "default" {
count = local.enabled && length(local.lc_rules) > 0 ? 1 : 0
bucket = local.bucket_id
count = local.enabled && length(local.lc_rules) > 0 ? 1 : 0
bucket = local.bucket_id
transition_default_minimum_object_size = var.lifecycle_transition_default_minimum_object_size

dynamic "rule" {
for_each = local.lc_rules
Expand Down
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ variable "lifecycle_configuration_rules" {
}
# See lifecycle.tf for conversion of deprecated `lifecycle_rules` to `lifecycle_configuration_rules`

variable "lifecycle_transition_default_minimum_object_size" {
type = string
default = "all_storage_classes_128K"
description = <<-EOT
Specifies the default minimum object size behavior applied to the lifecycle configuration.
Valid values are `all_storage_classes_128K`(default) and `varies_by_storage_class`.
EOT
validation {
condition = contains(["all_storage_classes_128K", "varies_by_storage_class"], var.lifecycle_transition_default_minimum_object_size)
error_message = "The default minimum object size for transitions must be either all_storage_classes_128K or varies_by_storage_class"
}
nullable = false
}

variable "cors_configuration" {
type = list(object({
Expand Down