Skip to content

Commit

Permalink
updated each lifecycle_rule argument to have a default value of [] (#57)
Browse files Browse the repository at this point in the history
* updated each lifecycle_rule argument to have a default value of []

* Continuous Integration - terraform fmt and terraform-docs

* whitespace

* converted to empty objects instead of empty lists

* Continuous Integration - terraform fmt and terraform-docs

* testing different default types

* Continuous Integration - terraform fmt and terraform-docs

* commented out the breaking type constraints

* added issue link

* Continuous Integration - terraform fmt and terraform-docs

* comment

---------

Co-authored-by: zachreborn <zachreborn@users.noreply.github.com>
  • Loading branch information
zachreborn and zachreborn committed Apr 2, 2024
1 parent 67d19c5 commit acc8a2d
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 68 deletions.
6 changes: 3 additions & 3 deletions modules/aws/s3/bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ module "bucket" {
```

### Lifecycle Rules Example
This example creates a bucket with multiple lifecycle rules configured to transition objects to Standard-IA after 30 days, Glacier after 60 days, and expire objects after 90 days.
This example creates a bucket with multiple lifecycle rules configured to transition objects to Standard-IA after 30 days, Glacier after 60 days, and expire objects after 90 days.
```
module "logging_bucket" {
source = "github.com/zachreborn/terraform-modules//modules/aws/s3/bucket"
Expand Down Expand Up @@ -234,7 +234,7 @@ module "app_bucket" {
```

### Intelligent Tiering Filter Example
This example makes use of a simple S3 bucket with intelligent tiering enabled. The intelligent tiering configuration will eventually end up with objects in the DEEP_ARCHIVE_ACCESS glacier tier after 120 days. Objects with the prefix 'test/' and tagged with 'project' = 'app' will utilize this intelligent tiering configuration.
This example makes use of a simple S3 bucket with intelligent tiering enabled. The intelligent tiering configuration will eventually end up with objects in the DEEP_ARCHIVE_ACCESS glacier tier after 120 days. Objects with the prefix 'test/' and tagged with 'project' = 'app' will utilize this intelligent tiering configuration.
```
module "app_bucket" {
source = "github.com/zachreborn/terraform-modules//modules/aws/s3/bucket"
Expand Down Expand Up @@ -381,7 +381,7 @@ No modules.
| <a name="input_key_name_prefix"></a> [key\_name\_prefix](#input\_key\_name\_prefix) | (Optional) Creates an unique alias beginning with the specified prefix. The name must start with the word alias followed by a forward slash (alias/). | `string` | `"alias/s3_key_"` | no |
| <a name="input_key_policy"></a> [key\_policy](#input\_key\_policy) | (Optional) A valid policy JSON document. Although this is a key policy, not an IAM policy, an aws\_iam\_policy\_document, in the form that designates a principal, can be used. For more information about building policy documents with Terraform, see the AWS IAM Policy Document Guide. | `string` | `""` | no |
| <a name="input_key_usage"></a> [key\_usage](#input\_key\_usage) | (Optional) Specifies the intended use of the key. Defaults to ENCRYPT\_DECRYPT, and only symmetric encryption and decryption are supported. | `string` | `"ENCRYPT_DECRYPT"` | no |
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_rules) | (Optional) Configuration of object lifecycle management (LCM). Can have several rules as a list of maps where each map is the lifecycle rule configuration. | <pre>list(object({<br> id = string<br> status = string<br> abort_incomplete_multipart_upload = optional(object({<br> days_after_initiation = number<br> }))<br> expiration = optional(object({<br> date = optional(string)<br> days = optional(number)<br> expired_object_delete_marker = optional(bool)<br> }))<br> filter = optional(object({<br> object_size_greater_than = optional(number)<br> object_size_less_than = optional(number)<br> prefix = optional(string)<br> tag = optional(map(string))<br> }))<br> noncurrent_version_expiration = optional(object({<br> newer_noncurrent_versions = optional(number)<br> noncurrent_days = optional(number)<br> }))<br> noncurrent_version_transitions = optional(list(object({<br> newer_noncurrent_versions = optional(number)<br> noncurrent_days = optional(number)<br> storage_class = optional(string)<br> })))<br> transition = optional(list(object({<br> date = optional(string)<br> days = optional(number)<br> storage_class = optional(string)<br> })), [])<br> }))</pre> | `null` | no |
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_rules) | (Optional) Configuration of object lifecycle management (LCM). Can have several rules as a list of maps where each map is the lifecycle rule configuration. | `any` | `null` | no |
| <a name="input_logging_target_bucket"></a> [logging\_target\_bucket](#input\_logging\_target\_bucket) | (Optional) The name of the bucket that will receive the logs. Required if logging of the S3 bucket is set to true. | `string` | `null` | no |
| <a name="input_logging_target_prefix"></a> [logging\_target\_prefix](#input\_logging\_target\_prefix) | (Optional) The prefix that is prepended to all log object keys. If not set, the logs are stored in the root of the bucket. | `string` | `"log/"` | no |
| <a name="input_mfa_delete"></a> [mfa\_delete](#input\_mfa\_delete) | (Optional) Specifies whether MFA delete is enabled in the bucket versioning configuration. Valid values: Enabled or Disabled. | `string` | `"Disabled"` | no |
Expand Down
66 changes: 34 additions & 32 deletions modules/aws/s3/bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,38 +179,40 @@ variable "intelligent_tiering_days" {

variable "lifecycle_rules" {
description = "(Optional) Configuration of object lifecycle management (LCM). Can have several rules as a list of maps where each map is the lifecycle rule configuration."
type = list(object({
id = string
status = string
abort_incomplete_multipart_upload = optional(object({
days_after_initiation = number
}))
expiration = optional(object({
date = optional(string)
days = optional(number)
expired_object_delete_marker = optional(bool)
}))
filter = optional(object({
object_size_greater_than = optional(number)
object_size_less_than = optional(number)
prefix = optional(string)
tag = optional(map(string))
}))
noncurrent_version_expiration = optional(object({
newer_noncurrent_versions = optional(number)
noncurrent_days = optional(number)
}))
noncurrent_version_transitions = optional(list(object({
newer_noncurrent_versions = optional(number)
noncurrent_days = optional(number)
storage_class = optional(string)
})))
transition = optional(list(object({
date = optional(string)
days = optional(number)
storage_class = optional(string)
})), [])
}))
type = any
# Commenting out as this is causing a bug where expiration is always being set to 0 days. https://github.com/zachreborn/terraform-modules/issues/60
# type = list(object({
# id = string
# status = string
# abort_incomplete_multipart_upload = optional(object({
# days_after_initiation = number
# }))
# expiration = optional(object({
# date = optional(string)
# days = optional(number)
# expired_object_delete_marker = optional(bool)
# }), {})
# filter = optional(object({
# object_size_greater_than = optional(number)
# object_size_less_than = optional(number)
# prefix = optional(string)
# tag = optional(map(string))
# }))
# noncurrent_version_expiration = optional(object({
# newer_noncurrent_versions = optional(number)
# noncurrent_days = optional(number)
# }))
# noncurrent_version_transitions = optional(list(object({
# newer_noncurrent_versions = optional(number)
# noncurrent_days = optional(number)
# storage_class = optional(string)
# })), [])
# transition = optional(list(object({
# date = optional(string)
# days = optional(number)
# storage_class = optional(string)
# })), [])
# }))
default = null
}

Expand Down
2 changes: 1 addition & 1 deletion modules/aws/transfer_family/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ _For more examples, please refer to the [Documentation](https://github.com/zachr
| <a name="input_host_key"></a> [host\_key](#input\_host\_key) | (Optional) The RSA, ECDSA, or ED25519 private key. This must be created ahead of time. | `string` | `null` | no |
| <a name="input_identity_provider_type"></a> [identity\_provider\_type](#input\_identity\_provider\_type) | (Optional) The mode of authentication enabled for this service. Valid values are SERVICE\_MANAGED or API\_GATEWAY | `string` | `"SERVICE_MANAGED"` | no |
| <a name="input_invocation_role"></a> [invocation\_role](#input\_invocation\_role) | (Optional) The ARN of the IAM role that controls your authentication with an identity provider\_type through API\_GATEWAY. | `string` | `null` | no |
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_rules) | (Optional) Configuration of object lifecycle management (LCM). Can have several rules as a list of maps where each map is the lifecycle rule configuration. | <pre>list(object({<br> id = string<br> status = string<br> abort_incomplete_multipart_upload = optional(object({<br> days_after_initiation = number<br> }))<br> expiration = optional(object({<br> date = optional(string)<br> days = optional(number)<br> expired_object_delete_marker = optional(bool)<br> }))<br> filter = optional(object({<br> object_size_greater_than = optional(number)<br> object_size_less_than = optional(number)<br> prefix = optional(string)<br> tag = optional(map(string))<br> }))<br> noncurrent_version_expiration = optional(object({<br> newer_noncurrent_versions = optional(number)<br> noncurrent_days = optional(number)<br> }))<br> noncurrent_version_transitions = optional(list(object({<br> newer_noncurrent_versions = optional(number)<br> noncurrent_days = optional(number)<br> storage_class = optional(string)<br> })))<br> transition = optional(list(object({<br> date = optional(string)<br> days = optional(number)<br> storage_class = optional(string)<br> })), [])<br> }))</pre> | `null` | no |
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_rules) | (Optional) Configuration of object lifecycle management (LCM). Can have several rules as a list of maps where each map is the lifecycle rule configuration. | `any` | `null` | no |
| <a name="input_logging_role"></a> [logging\_role](#input\_logging\_role) | (Optional) The ARN of the IAM role that allows the service to write your server access logs to a Amazon CloudWatch log group. | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | (Required) The name of the AWS Transfer Family server used to name the resources created. | `string` | n/a | yes |
| <a name="input_passive_ip"></a> [passive\_ip](#input\_passive\_ip) | (Optional) Sets passive mode for FTP and FTPS protocols and the associated IPv4 address to associate. | `string` | `null` | no |
Expand Down
66 changes: 34 additions & 32 deletions modules/aws/transfer_family/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,38 +178,40 @@ variable "vpc_id" {

variable "lifecycle_rules" {
description = "(Optional) Configuration of object lifecycle management (LCM). Can have several rules as a list of maps where each map is the lifecycle rule configuration."
type = list(object({
id = string
status = string
abort_incomplete_multipart_upload = optional(object({
days_after_initiation = number
}))
expiration = optional(object({
date = optional(string)
days = optional(number)
expired_object_delete_marker = optional(bool)
}))
filter = optional(object({
object_size_greater_than = optional(number)
object_size_less_than = optional(number)
prefix = optional(string)
tag = optional(map(string))
}))
noncurrent_version_expiration = optional(object({
newer_noncurrent_versions = optional(number)
noncurrent_days = optional(number)
}))
noncurrent_version_transitions = optional(list(object({
newer_noncurrent_versions = optional(number)
noncurrent_days = optional(number)
storage_class = optional(string)
})))
transition = optional(list(object({
date = optional(string)
days = optional(number)
storage_class = optional(string)
})), [])
}))
type = any
# Commenting out as this is causing a bug where expiration is always being set to 0 days. https://github.com/zachreborn/terraform-modules/issues/60
# type = list(object({
# id = string
# status = string
# abort_incomplete_multipart_upload = optional(object({
# days_after_initiation = number
# }), [])
# expiration = optional(object({
# date = optional(string)
# days = optional(number)
# expired_object_delete_marker = optional(bool)
# }), [])
# filter = optional(object({
# object_size_greater_than = optional(number)
# object_size_less_than = optional(number)
# prefix = optional(string)
# tag = optional(map(string))
# }), [])
# noncurrent_version_expiration = optional(object({
# newer_noncurrent_versions = optional(number)
# noncurrent_days = optional(number)
# }), [])
# noncurrent_version_transitions = optional(list(object({
# newer_noncurrent_versions = optional(number)
# noncurrent_days = optional(number)
# storage_class = optional(string)
# })), [])
# transition = optional(list(object({
# date = optional(string)
# days = optional(number)
# storage_class = optional(string)
# })), [])
# }))
default = null
}

Expand Down

0 comments on commit acc8a2d

Please sign in to comment.