diff --git a/README.md b/README.md index 5df2b8b..af6c107 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,28 @@ module "s3_bucket" { } ``` +If you do not specify lifecycle rules when calling this module, none will be created. +Custom lifecycle rules: +``` +enable_lifecycle_configuration_rules = true +lifecycle_configuration_rules = [ + { + id = "default" + enabled = true + + enable_glacier_transition = true + enable_current_object_expiration = true + enable_noncurrent_version_expiration = true + + abort_incomplete_multipart_upload_days = 1 + noncurrent_version_glacier_transition_days = 90 + noncurrent_version_expiration_days = 365 + glacier_transition_days = 90 + expiration_days = 365 + } + ] +``` + ## Requirements @@ -122,20 +144,20 @@ No modules. | [block\_public\_policy](#input\_block\_public\_policy) | Whether Amazon S3 should block public bucket policies for this bucket. | `bool` | `false` | no | | [bucket\_policy](#input\_bucket\_policy) | Conditionally create S3 bucket policy. | `bool` | `false` | no | | [control\_object\_ownership](#input\_control\_object\_ownership) | Whether to manage S3 Bucket Ownership Controls on this bucket. | `bool` | `false` | no | -| [cors\_rule](#input\_cors\_rule) | CORS Configuration specification for this bucket |
list(object({| `null` | no | +| [cors\_rule](#input\_cors\_rule) | CORS Configuration specification for this bucket |
allowed_headers = list(string)
allowed_methods = list(string)
allowed_origins = list(string)
expose_headers = list(string)
max_age_seconds = number
}))
list(object({| `null` | no | | [create\_bucket](#input\_create\_bucket) | Conditionally create S3 bucket. | `bool` | `true` | no | | [enable\_kms](#input\_enable\_kms) | Enable KMS key for enable\_server\_side\_encryption | `bool` | `true` | no | -| [enable\_lifecycle\_configuration\_rules](#input\_enable\_lifecycle\_configuration\_rules) | enable or disable lifecycle\_configuration\_rules | `bool` | `true` | no | +| [enable\_lifecycle\_configuration\_rules](#input\_enable\_lifecycle\_configuration\_rules) | enable or disable lifecycle\_configuration\_rules | `bool` | `false` | no | | [enable\_server\_side\_encryption](#input\_enable\_server\_side\_encryption) | Enable enable\_server\_side\_encryption | `bool` | `true` | no | | [error\_document](#input\_error\_document) | he name of the error document for the website | `string` | `"error.html"` | no | | [force\_destroy](#input\_force\_destroy) | A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable. | `bool` | `false` | no | | [ignore\_public\_acls](#input\_ignore\_public\_acls) | Whether Amazon S3 should ignore public ACLs for this bucket. | `bool` | `false` | no | | [index\_document](#input\_index\_document) | The name of the index document for the website | `string` | `"index.html"` | no | | [kms\_master\_key\_id](#input\_kms\_master\_key\_id) | The AWS KMS master key ID used for the SSE-KMS encryption. This can only be used when you set the value of sse\_algorithm as aws:kms. The default aws/s3 AWS KMS master key is used if this element is absent while the sse\_algorithm is aws:kms. | `string` | `null` | no | -| [lifecycle\_configuration\_rules](#input\_lifecycle\_configuration\_rules) | A list of lifecycle rules |
allowed_headers = list(string)
allowed_methods = list(string)
allowed_origins = list(string)
expose_headers = list(string)
max_age_seconds = number
}))
list(object({|
id = string
prefix = optional(string, null)
enabled = bool
tags = optional(map(string), null)
enable_glacier_transition = optional(bool, true)
enable_deeparchive_transition = optional(bool, false)
enable_standard_ia_transition = optional(bool, false)
enable_current_object_expiration = optional(bool, true)
enable_noncurrent_version_expiration = optional(bool, true)
abort_incomplete_multipart_upload_days = optional(number, null)
noncurrent_version_glacier_transition_days = optional(number, null)
noncurrent_version_deeparchive_transition_days = optional(number, null)
noncurrent_version_expiration_days = optional(number, null)
standard_transition_days = optional(number, null)
glacier_transition_days = optional(number, null)
deeparchive_transition_days = optional(number, null)
expiration_days = optional(number, null)
}))
[| no | +| [lifecycle\_configuration\_rules](#input\_lifecycle\_configuration\_rules) | A list of lifecycle rules |
{
"abort_incomplete_multipart_upload_days": 1,
"enable_current_object_expiration": true,
"enable_glacier_transition": true,
"enable_noncurrent_version_expiration": true,
"enabled": true,
"expiration_days": 365,
"glacier_transition_days": 90,
"id": "default",
"noncurrent_version_expiration_days": 365,
"noncurrent_version_glacier_transition_days": 90
}
]
list(object({| `[]` | no | | [logging](#input\_logging) | Logging Object to enable and disable logging | `bool` | `false` | no | | [name](#input\_name) | Name of S3 bucket | `string` | n/a | yes | -| [object\_lock\_configuration](#input\_object\_lock\_configuration) | With S3 Object Lock, you can store objects using a write-once-read-many (WORM) model. Object Lock can help prevent objects from being deleted or overwritten for a fixed amount of time or indefinitely. |
id = optional(string)
prefix = optional(string, null)
enabled = optional(bool)
tags = optional(map(string), null)
enable_glacier_transition = optional(bool, true)
enable_deeparchive_transition = optional(bool, false)
enable_standard_ia_transition = optional(bool, false)
enable_current_object_expiration = optional(bool, true)
enable_noncurrent_version_expiration = optional(bool, true)
abort_incomplete_multipart_upload_days = optional(number, null)
noncurrent_version_glacier_transition_days = optional(number, null)
noncurrent_version_deeparchive_transition_days = optional(number, null)
noncurrent_version_expiration_days = optional(number, null)
standard_transition_days = optional(number, null)
glacier_transition_days = optional(number, null)
deeparchive_transition_days = optional(number, null)
expiration_days = optional(number, null)
}))
object({| `null` | no | +| [object\_lock\_configuration](#input\_object\_lock\_configuration) | With S3 Object Lock, you can store objects using a write-once-read-many (WORM) model. Object Lock can help prevent objects from being deleted or overwritten for a fixed amount of time or indefinitely. |
mode = string #Valid values are GOVERNANCE and COMPLIANCE.
days = number
years = number
})
object({| `null` | no | | [object\_ownership](#input\_object\_ownership) | Object ownership. Valid values: BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter. 'BucketOwnerEnforced': ACLs are disabled, and the bucket owner automatically owns and has full control over every object in the bucket. 'BucketOwnerPreferred': Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL. 'ObjectWriter': The uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. | `string` | `"ObjectWriter"` | no | | [redirect](#input\_redirect) | The redirect behavior for every request to this bucket's website endpoint | `string` | `"documents/"` | no | | [request\_payer](#input\_request\_payer) | Specifies who should bear the cost of Amazon S3 data transfer. Can be either BucketOwner or Requester. By default, the owner of the S3 bucket would incur the costs of any data transfer | `bool` | `false` | no | diff --git a/variables.tf b/variables.tf index c0dbce1..ce0f467 100644 --- a/variables.tf +++ b/variables.tf @@ -47,15 +47,15 @@ variable "kms_master_key_id" { variable "enable_lifecycle_configuration_rules" { type = bool - default = true + default = false description = "enable or disable lifecycle_configuration_rules" } variable "lifecycle_configuration_rules" { type = list(object({ - id = string + id = optional(string) prefix = optional(string, null) - enabled = bool + enabled = optional(bool) tags = optional(map(string), null) enable_glacier_transition = optional(bool, true) @@ -74,22 +74,7 @@ variable "lifecycle_configuration_rules" { deeparchive_transition_days = optional(number, null) expiration_days = optional(number, null) })) - default = [ - { - id = "default" - enabled = true - - enable_glacier_transition = true - enable_current_object_expiration = true - enable_noncurrent_version_expiration = true - - abort_incomplete_multipart_upload_days = 1 - noncurrent_version_glacier_transition_days = 90 - noncurrent_version_expiration_days = 365 - glacier_transition_days = 90 - expiration_days = 365 - } - ] + default = [] description = "A list of lifecycle rules" }
mode = string #Valid values are GOVERNANCE and COMPLIANCE.
days = number
years = number
})