|
| 1 | +# Cloud Object Storage lifecycle_rules module |
| 2 | + |
| 3 | +You can use this submodule to configure multiple lifecycle rules to existing IBM [Cloud Object Storage](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-getting-started-cloud-object-storage) buckets. |
| 4 | + |
| 5 | +You can configure the following multiple rules to your buckets: |
| 6 | +- [expiration](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-expiry) |
| 7 | +- [noncurrent version expiration](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-expiry#noncurrentversionexpiration) |
| 8 | +- [abort incomplete multipart](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-lifecycle-cleanup-mpu) |
| 9 | + |
| 10 | +### Usage |
| 11 | +```hcl |
| 12 | +module "advance_lifecycle_rules" { |
| 13 | + source = "terraform-ibm-modules/cos/ibm//modules/lifecycle_rules" |
| 14 | + cos_region = "region of the existing bucket" |
| 15 | + bucket_crn = "crn:v1:bluemix:public:cloud-object-storage:global:a/xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX:bucket:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" # existing bucket crn |
| 16 | + object_versioning_enabled = false # False by default , must be set to true for noncurrent version expiration lifecycle rule |
| 17 | + expiry_rules = [ |
| 18 | + { |
| 19 | + rule_id = "expiry-info-7d" |
| 20 | + days = 7 |
| 21 | + prefix = "info-" |
| 22 | + }, |
| 23 | + { |
| 24 | + rule_id = "expiry-error-30d" |
| 25 | + days = 30 |
| 26 | + prefix = "error-" |
| 27 | + } |
| 28 | + ] |
| 29 | +
|
| 30 | + noncurrent_expiry_rules = [ |
| 31 | + { |
| 32 | + rule_id = "ncv-expire-45d" |
| 33 | + noncurrent_days = 45 |
| 34 | + prefix = "data/" |
| 35 | + }, |
| 36 | + { |
| 37 | + rule_id = "ncv-expire-90d" |
| 38 | + noncurrent_days = 90 |
| 39 | + prefix = "archive/" |
| 40 | + } |
| 41 | + ] |
| 42 | +
|
| 43 | + abort_multipart_rules = [ |
| 44 | + { |
| 45 | + rule_id = "abort-stale-7d" |
| 46 | + days_after_initiation = 7 |
| 47 | + prefix = "" |
| 48 | + }, |
| 49 | + { |
| 50 | + rule_id = "abort-temp-3d" |
| 51 | + days_after_initiation = 3 |
| 52 | + prefix = "tmp/" |
| 53 | + } |
| 54 | + ] |
| 55 | +
|
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | + |
| 60 | +<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
| 61 | +### Requirements |
| 62 | + |
| 63 | +| Name | Version | |
| 64 | +|------|---------| |
| 65 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 | |
| 66 | +| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.79.2, < 2.0.0 | |
| 67 | + |
| 68 | +### Modules |
| 69 | + |
| 70 | +No modules. |
| 71 | + |
| 72 | +### Resources |
| 73 | + |
| 74 | +| Name | Type | |
| 75 | +|------|------| |
| 76 | +| [ibm_cos_bucket_lifecycle_configuration.advance_bucket_lifecycle](https://registry.terraform.io/providers/ibm-cloud/ibm/latest/docs/resources/cos_bucket_lifecycle_configuration) | resource | |
| 77 | + |
| 78 | +### Inputs |
| 79 | + |
| 80 | +| Name | Description | Type | Default | Required | |
| 81 | +|------|-------------|------|---------|:--------:| |
| 82 | +| <a name="input_abort_multipart_rules"></a> [abort\_multipart\_rules](#input\_abort\_multipart\_rules) | List of abort incomplete multipart upload rules | <pre>list(object({<br/> rule_id = optional(string)<br/> status = optional(string, "enable")<br/> days_after_initiation = number<br/> prefix = optional(string, "")<br/> }))</pre> | `[]` | no | |
| 83 | +| <a name="input_bucket_crn"></a> [bucket\_crn](#input\_bucket\_crn) | The CRN of an existing Cloud Object Storage bucket. | `string` | n/a | yes | |
| 84 | +| <a name="input_cos_region"></a> [cos\_region](#input\_cos\_region) | The region of existing Cloud Object Storage bucket. | `string` | n/a | yes | |
| 85 | +| <a name="input_expiry_rules"></a> [expiry\_rules](#input\_expiry\_rules) | List of expiry rules | <pre>list(object({<br/> rule_id = optional(string)<br/> status = optional(string, "enable")<br/> days = number<br/> prefix = optional(string, "")<br/> }))</pre> | `[]` | no | |
| 86 | +| <a name="input_management_endpoint_type_for_bucket"></a> [management\_endpoint\_type\_for\_bucket](#input\_management\_endpoint\_type\_for\_bucket) | The type of endpoint for the IBM terraform provider to manage the bucket. Possible values are `public`, `private`, or `direct`. | `string` | `"public"` | no | |
| 87 | +| <a name="input_noncurrent_expiry_rules"></a> [noncurrent\_expiry\_rules](#input\_noncurrent\_expiry\_rules) | List of noncurrent version expiration rules , note : this lifecycle rule requires object versioning make sure object versioning is enabled on the bucket | <pre>list(object({<br/> rule_id = optional(string)<br/> status = optional(string, "enable")<br/> noncurrent_days = number<br/> prefix = optional(string, "")<br/> }))</pre> | `[]` | no | |
| 88 | + |
| 89 | +### Outputs |
| 90 | + |
| 91 | +| Name | Description | |
| 92 | +|------|-------------| |
| 93 | +| <a name="output_bucket_crn"></a> [bucket\_crn](#output\_bucket\_crn) | Bucket CRN | |
| 94 | +| <a name="output_bucket_id"></a> [bucket\_id](#output\_bucket\_id) | Bucket ID | |
| 95 | +| <a name="output_bucket_location"></a> [bucket\_location](#output\_bucket\_location) | Bucket location | |
| 96 | +<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
0 commit comments