Skip to content

Commit e48f09c

Browse files
authored
context.tf updated to v0.24.1, minimum required Terraform version bumped to 0.13.0 when needed, readme updated (#14)
1 parent f2df6c1 commit e48f09c

File tree

8 files changed

+116
-84
lines changed

8 files changed

+116
-84
lines changed

.github/CODEOWNERS

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
# Cloud Posse must review any changes to standard context definition,
1717
# but some changes can be rubber-stamped.
18-
**/context.tf @cloudposse/engineering @cloudposse/approvers
19-
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
20-
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
18+
**/*.tf @cloudposse/engineering @cloudposse/approvers
19+
README.yaml @cloudposse/engineering @cloudposse/approvers
20+
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
21+
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
2122

2223
# Cloud Posse Admins must review all changes to CODEOWNERS or the mergify configuration
2324
.github/mergify.yml @cloudposse/admins

.github/workflows/auto-readme.yml

-41
This file was deleted.

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Available targets:
131131

132132
| Name | Version |
133133
|------|---------|
134-
| terraform | >= 0.12.26 |
134+
| terraform | >= 0.13.0 |
135135
| aws | >= 2.0 |
136136
| local | >= 1.3 |
137137
| null | >= 2.1 |
@@ -150,14 +150,16 @@ Available targets:
150150
|------|-------------|------|---------|:--------:|
151151
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
152152
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
153-
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
153+
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
154154
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
155155
| ecdsa\_curve | When ssh\_key\_algorithm is 'ECDSA', the name of the elliptic curve to use. May be any one of 'P256', 'P384' or P521' | `string` | `"P256"` | no |
156156
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
157157
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
158-
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
158+
| id\_length\_limit | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
159159
| kms\_key\_id | KMS Key ID used for encryption | `string` | `""` | no |
160+
| label\_key\_case | The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
160161
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
162+
| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Default value: `lower`. | `string` | `null` | no |
161163
| name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
162164
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
163165
| overwrite\_ssm\_parameter | Whether to overwrite an existing SSM parameter | `bool` | `true` | no |

context.tf

+50-16
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
module "this" {
2222
source = "cloudposse/label/null"
23-
version = "0.22.1" // requires Terraform >= 0.12.26
23+
version = "0.24.1" # requires Terraform >= 0.13.0
2424

2525
enabled = var.enabled
2626
namespace = var.namespace
@@ -34,27 +34,16 @@ module "this" {
3434
label_order = var.label_order
3535
regex_replace_chars = var.regex_replace_chars
3636
id_length_limit = var.id_length_limit
37+
label_key_case = var.label_key_case
38+
label_value_case = var.label_value_case
3739

3840
context = var.context
3941
}
4042

4143
# Copy contents of cloudposse/terraform-null-label/variables.tf here
4244

4345
variable "context" {
44-
type = object({
45-
enabled = bool
46-
namespace = string
47-
environment = string
48-
stage = string
49-
name = string
50-
delimiter = string
51-
attributes = list(string)
52-
tags = map(string)
53-
additional_tag_map = map(string)
54-
regex_replace_chars = string
55-
label_order = list(string)
56-
id_length_limit = number
57-
})
46+
type = any
5847
default = {
5948
enabled = true
6049
namespace = null
@@ -68,6 +57,8 @@ variable "context" {
6857
regex_replace_chars = null
6958
label_order = []
7059
id_length_limit = null
60+
label_key_case = null
61+
label_value_case = null
7162
}
7263
description = <<-EOT
7364
Single object for setting entire context at once.
@@ -76,6 +67,16 @@ variable "context" {
7667
Individual variable settings (non-null) override settings in context object,
7768
except for attributes, tags, and additional_tag_map, which are merged.
7869
EOT
70+
71+
validation {
72+
condition = lookup(var.context, "label_key_case", null) == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
73+
error_message = "Allowed values: `lower`, `title`, `upper`."
74+
}
75+
76+
validation {
77+
condition = lookup(var.context, "label_value_case", null) == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
78+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
79+
}
7980
}
8081

8182
variable "enabled" {
@@ -158,11 +159,44 @@ variable "id_length_limit" {
158159
type = number
159160
default = null
160161
description = <<-EOT
161-
Limit `id` to this many characters.
162+
Limit `id` to this many characters (minimum 6).
162163
Set to `0` for unlimited length.
163164
Set to `null` for default, which is `0`.
164165
Does not affect `id_full`.
165166
EOT
167+
validation {
168+
condition = var.id_length_limit == null ? true : var.id_length_limit >= 6 || var.id_length_limit == 0
169+
error_message = "The id_length_limit must be >= 6 if supplied (not null), or 0 for unlimited length."
170+
}
171+
}
172+
173+
variable "label_key_case" {
174+
type = string
175+
default = null
176+
description = <<-EOT
177+
The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
178+
Possible values: `lower`, `title`, `upper`.
179+
Default value: `title`.
180+
EOT
181+
182+
validation {
183+
condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
184+
error_message = "Allowed values: `lower`, `title`, `upper`."
185+
}
166186
}
167187

188+
variable "label_value_case" {
189+
type = string
190+
default = null
191+
description = <<-EOT
192+
The letter case of output label values (also used in `tags` and `id`).
193+
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
194+
Default value: `lower`.
195+
EOT
196+
197+
validation {
198+
condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
199+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
200+
}
201+
}
168202
#### End of copy of cloudposse/terraform-null-label/variables.tf

docs/terraform.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
| Name | Version |
55
|------|---------|
6-
| terraform | >= 0.12.26 |
6+
| terraform | >= 0.13.0 |
77
| aws | >= 2.0 |
88
| local | >= 1.3 |
99
| null | >= 2.1 |
@@ -22,14 +22,16 @@
2222
|------|-------------|------|---------|:--------:|
2323
| additional\_tag\_map | Additional tags for appending to tags\_as\_list\_of\_maps. Not added to `tags`. | `map(string)` | `{}` | no |
2424
| attributes | Additional attributes (e.g. `1`) | `list(string)` | `[]` | no |
25-
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | <pre>object({<br> enabled = bool<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> delimiter = string<br> attributes = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> label_order = list(string)<br> id_length_limit = number<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_order": [],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
25+
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
2626
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
2727
| ecdsa\_curve | When ssh\_key\_algorithm is 'ECDSA', the name of the elliptic curve to use. May be any one of 'P256', 'P384' or P521' | `string` | `"P256"` | no |
2828
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
2929
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
30-
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
30+
| id\_length\_limit | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
3131
| kms\_key\_id | KMS Key ID used for encryption | `string` | `""` | no |
32+
| label\_key\_case | The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
3233
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
34+
| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Default value: `lower`. | `string` | `null` | no |
3335
| name | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
3436
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
3537
| overwrite\_ssm\_parameter | Whether to overwrite an existing SSM parameter | `bool` | `true` | no |

examples/complete/context.tf

+50-16
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
module "this" {
2222
source = "cloudposse/label/null"
23-
version = "0.22.1" // requires Terraform >= 0.12.26
23+
version = "0.24.1" # requires Terraform >= 0.13.0
2424

2525
enabled = var.enabled
2626
namespace = var.namespace
@@ -34,27 +34,16 @@ module "this" {
3434
label_order = var.label_order
3535
regex_replace_chars = var.regex_replace_chars
3636
id_length_limit = var.id_length_limit
37+
label_key_case = var.label_key_case
38+
label_value_case = var.label_value_case
3739

3840
context = var.context
3941
}
4042

4143
# Copy contents of cloudposse/terraform-null-label/variables.tf here
4244

4345
variable "context" {
44-
type = object({
45-
enabled = bool
46-
namespace = string
47-
environment = string
48-
stage = string
49-
name = string
50-
delimiter = string
51-
attributes = list(string)
52-
tags = map(string)
53-
additional_tag_map = map(string)
54-
regex_replace_chars = string
55-
label_order = list(string)
56-
id_length_limit = number
57-
})
46+
type = any
5847
default = {
5948
enabled = true
6049
namespace = null
@@ -68,6 +57,8 @@ variable "context" {
6857
regex_replace_chars = null
6958
label_order = []
7059
id_length_limit = null
60+
label_key_case = null
61+
label_value_case = null
7162
}
7263
description = <<-EOT
7364
Single object for setting entire context at once.
@@ -76,6 +67,16 @@ variable "context" {
7667
Individual variable settings (non-null) override settings in context object,
7768
except for attributes, tags, and additional_tag_map, which are merged.
7869
EOT
70+
71+
validation {
72+
condition = lookup(var.context, "label_key_case", null) == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
73+
error_message = "Allowed values: `lower`, `title`, `upper`."
74+
}
75+
76+
validation {
77+
condition = lookup(var.context, "label_value_case", null) == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
78+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
79+
}
7980
}
8081

8182
variable "enabled" {
@@ -158,11 +159,44 @@ variable "id_length_limit" {
158159
type = number
159160
default = null
160161
description = <<-EOT
161-
Limit `id` to this many characters.
162+
Limit `id` to this many characters (minimum 6).
162163
Set to `0` for unlimited length.
163164
Set to `null` for default, which is `0`.
164165
Does not affect `id_full`.
165166
EOT
167+
validation {
168+
condition = var.id_length_limit == null ? true : var.id_length_limit >= 6 || var.id_length_limit == 0
169+
error_message = "The id_length_limit must be >= 6 if supplied (not null), or 0 for unlimited length."
170+
}
171+
}
172+
173+
variable "label_key_case" {
174+
type = string
175+
default = null
176+
description = <<-EOT
177+
The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
178+
Possible values: `lower`, `title`, `upper`.
179+
Default value: `title`.
180+
EOT
181+
182+
validation {
183+
condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
184+
error_message = "Allowed values: `lower`, `title`, `upper`."
185+
}
166186
}
167187

188+
variable "label_value_case" {
189+
type = string
190+
default = null
191+
description = <<-EOT
192+
The letter case of output label values (also used in `tags` and `id`).
193+
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
194+
Default value: `lower`.
195+
EOT
196+
197+
validation {
198+
condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
199+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
200+
}
201+
}
168202
#### End of copy of cloudposse/terraform-null-label/variables.tf

examples/complete/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 0.12.26"
2+
required_version = ">= 0.13.0"
33

44
required_providers {
55
aws = {

versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 0.12.26"
2+
required_version = ">= 0.13.0"
33

44
required_providers {
55
aws = {

0 commit comments

Comments
 (0)