Skip to content

Commit 6086145

Browse files
authored
Ease refactoring by adding backward compatible lifecycle IDs (#134)
1 parent f61532b commit 6086145

File tree

10 files changed

+30
-593
lines changed

10 files changed

+30
-593
lines changed

.github/.github-update-disabled

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This presence of a .github/.github-update-disabled file
2+
prevents `make github/update` from making any changes.
3+
The contents of the file are ignored.

.github/renovate.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
{
2-
"extends": [
3-
"config:base",
4-
":preserveSemverRanges"
5-
],
6-
"labels": ["auto-update"],
7-
"enabledManagers": ["terraform"],
8-
"terraform": {
9-
"ignorePaths": ["**/context.tf", "examples/**"]
10-
}
2+
"enabled": false
113
}
12-

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,14 @@ Available targets:
213213
| Name | Version |
214214
|------|---------|
215215
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
216-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.68.0 |
216+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.68.0, < 4.0 |
217217
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.7 |
218218

219219
## Providers
220220

221221
| Name | Version |
222222
|------|---------|
223-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.68.0 |
223+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.68.0, < 4.0 |
224224
| <a name="provider_time"></a> [time](#provider\_time) | >= 0.7 |
225225

226226
## Modules
@@ -277,6 +277,7 @@ Available targets:
277277
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
278278
| <a name="input_label_value_case"></a> [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,<br>set as tag values, and output by this module individually.<br>Does not affect values of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.<br>Default value: `lower`. | `string` | `null` | no |
279279
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
280+
| <a name="input_lifecycle_rule_ids"></a> [lifecycle\_rule\_ids](#input\_lifecycle\_rule\_ids) | A list of IDs to assign to corresponding `lifecycle_rules` | `list(string)` | `[]` | no |
280281
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_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> | <pre>[<br> {<br> "abort_incomplete_multipart_upload_days": 90,<br> "deeparchive_transition_days": 90,<br> "enable_current_object_expiration": true,<br> "enable_deeparchive_transition": false,<br> "enable_glacier_transition": true,<br> "enable_noncurrent_version_expiration": true,<br> "enable_standard_ia_transition": false,<br> "enabled": false,<br> "expiration_days": 90,<br> "glacier_transition_days": 60,<br> "noncurrent_version_deeparchive_transition_days": 60,<br> "noncurrent_version_expiration_days": 90,<br> "noncurrent_version_glacier_transition_days": 30,<br> "prefix": "",<br> "standard_transition_days": 30,<br> "tags": {}<br> }<br>]</pre> | no |
281282
| <a name="input_logging"></a> [logging](#input\_logging) | Bucket access logging configuration. | <pre>object({<br> bucket_name = string<br> prefix = string<br> })</pre> | `null` | no |
282283
| <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 |

docs/terraform.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
| Name | Version |
55
|------|---------|
66
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.68.0 |
7+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.68.0, < 4.0 |
88
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.7 |
99

1010
## Providers
1111

1212
| Name | Version |
1313
|------|---------|
14-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.68.0 |
14+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.68.0, < 4.0 |
1515
| <a name="provider_time"></a> [time](#provider\_time) | >= 0.7 |
1616

1717
## Modules
@@ -68,6 +68,7 @@
6868
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
6969
| <a name="input_label_value_case"></a> [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,<br>set as tag values, and output by this module individually.<br>Does not affect values of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.<br>Default value: `lower`. | `string` | `null` | no |
7070
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
71+
| <a name="input_lifecycle_rule_ids"></a> [lifecycle\_rule\_ids](#input\_lifecycle\_rule\_ids) | A list of IDs to assign to corresponding `lifecycle_rules` | `list(string)` | `[]` | no |
7172
| <a name="input_lifecycle_rules"></a> [lifecycle\_rules](#input\_lifecycle\_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> | <pre>[<br> {<br> "abort_incomplete_multipart_upload_days": 90,<br> "deeparchive_transition_days": 90,<br> "enable_current_object_expiration": true,<br> "enable_deeparchive_transition": false,<br> "enable_glacier_transition": true,<br> "enable_noncurrent_version_expiration": true,<br> "enable_standard_ia_transition": false,<br> "enabled": false,<br> "expiration_days": 90,<br> "glacier_transition_days": 60,<br> "noncurrent_version_deeparchive_transition_days": 60,<br> "noncurrent_version_expiration_days": 90,<br> "noncurrent_version_glacier_transition_days": 30,<br> "prefix": "",<br> "standard_transition_days": 30,<br> "tags": {}<br> }<br>]</pre> | no |
7273
| <a name="input_logging"></a> [logging](#input\_logging) | Bucket access logging configuration. | <pre>object({<br> bucket_name = string<br> prefix = string<br> })</pre> | `null` | no |
7374
| <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 |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ resource "aws_s3_bucket" "default" {
3535
for_each = var.lifecycle_rules
3636
content {
3737
enabled = lifecycle_rule.value.enabled
38+
id = try(var.lifecycle_rule_ids[lifecycle_rule.key], null)
3839
prefix = lifecycle_rule.value.prefix
3940
tags = lifecycle_rule.value.tags
4041
abort_incomplete_multipart_upload_days = lifecycle_rule.value.abort_incomplete_multipart_upload_days

test/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ clean:
3333
all: module examples/complete
3434

3535
## Run basic sanity checks against the module itself
36+
# ON THIS MAINTENANCE BRANCH we allow and require module pinning
3637
module: export TESTS ?= installed lint get-modules module-pinning get-plugins provider-pinning validate terraform-docs input-descriptions output-descriptions
38+
# module: export TESTS ?= installed lint get-modules get-plugins provider-pinning validate terraform-docs input-descriptions output-descriptions
3739
module: deps
3840
$(call RUN_TESTS, ../)
3941

test/src/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/cloudposse/terraform-aws-s3-bucket
33
go 1.17
44

55
require (
6-
github.com/gruntwork-io/terratest v0.38.8
6+
github.com/gruntwork-io/terratest v0.39.0
77
github.com/stretchr/testify v1.7.0
88
)
99

@@ -37,7 +37,7 @@ require (
3737
github.com/hashicorp/go-safetemp v1.0.0 // indirect
3838
github.com/hashicorp/go-version v1.3.0 // indirect
3939
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
40-
github.com/hashicorp/terraform-json v0.12.0 // indirect
40+
github.com/hashicorp/terraform-json v0.13.0 // indirect
4141
github.com/imdario/mergo v0.3.11 // indirect
4242
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
4343
github.com/jmespath/go-jmespath v0.4.0 // indirect
@@ -57,7 +57,7 @@ require (
5757
github.com/tmccombs/hcl2json v0.3.3 // indirect
5858
github.com/ulikunitz/xz v0.5.8 // indirect
5959
github.com/urfave/cli v1.22.2 // indirect
60-
github.com/zclconf/go-cty v1.8.1 // indirect
60+
github.com/zclconf/go-cty v1.9.1 // indirect
6161
go.opencensus.io v0.23.0 // indirect
6262
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
6363
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect

0 commit comments

Comments
 (0)