Skip to content

Commit 6f971ad

Browse files
authored
minimum required Terraform version bumped to 0.13.0, context.tf updated, readme updated (#162)
1 parent 48e2cd4 commit 6f971ad

File tree

9 files changed

+111
-19
lines changed

9 files changed

+111
-19
lines changed

.github/workflows/auto-context.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
make init
2828
make github/init/context.tf
2929
make readme/build
30-
echo "::set-output name=create_pull_request=true"
30+
echo "::set-output name=create_pull_request::true"
3131
fi
3232
else
3333
echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates."
@@ -38,6 +38,8 @@ jobs:
3838
uses: cloudposse/actions/github/[email protected]
3939
with:
4040
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
41+
committer: 'cloudpossebot <[email protected]>'
42+
author: 'cloudpossebot <[email protected]>'
4143
commit-message: Update context.tf from origin source
4244
title: Update context.tf
4345
body: |-

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Available targets:
210210

211211
| Name | Version |
212212
|------|---------|
213-
| terraform | >= 0.12.26 |
213+
| terraform | >= 0.13.0 |
214214
| aws | >= 2.0 |
215215

216216
## Providers
@@ -243,7 +243,7 @@ Available targets:
243243
| autoscale\_upper\_bound | Maximum level of autoscale metric to add an instance | `number` | `80` | no |
244244
| autoscale\_upper\_increment | How many Amazon EC2 instances to add when performing a scaling activity | `number` | `1` | no |
245245
| availability\_zone\_selector | Availability Zone selector | `string` | `"Any 2"` | no |
246-
| 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 |
246+
| 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> label_key_case = string<br> label_value_case = string<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_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 |
247247
| 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 |
248248
| deployment\_batch\_size | Percentage or fixed number of Amazon EC2 instances in the Auto Scaling group on which to simultaneously perform deployments. Valid values vary per deployment\_batch\_size\_type setting | `number` | `1` | no |
249249
| deployment\_batch\_size\_type | The type of number that is specified in deployment\_batch\_size\_type | `string` | `"Fixed"` | no |
@@ -273,7 +273,9 @@ Available targets:
273273
| instance\_refresh\_enabled | Enable weekly instance replacement. | `bool` | `true` | no |
274274
| instance\_type | Instances type | `string` | `"t2.micro"` | no |
275275
| keypair | Name of SSH key that will be deployed on Elastic Beanstalk and DataPipeline instance. The key should be present in AWS | `string` | `""` | no |
276+
| 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 |
276277
| 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 |
278+
| 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 |
277279
| loadbalancer\_certificate\_arn | Load Balancer SSL certificate ARN. The certificate must be present in AWS Certificate Manager | `string` | `""` | no |
278280
| loadbalancer\_crosszone | Configure the classic load balancer to route traffic evenly across all instances in all Availability Zones rather than only within each zone. | `bool` | `true` | no |
279281
| loadbalancer\_managed\_security\_group | Load balancer managed security group | `string` | `""` | no |

context.tf

+44-1
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.23.0" // requires Terraform >= 0.13.0
2424

2525
enabled = var.enabled
2626
namespace = var.namespace
@@ -54,6 +54,8 @@ variable "context" {
5454
regex_replace_chars = string
5555
label_order = list(string)
5656
id_length_limit = number
57+
label_key_case = string
58+
label_value_case = string
5759
})
5860
default = {
5961
enabled = true
@@ -68,6 +70,8 @@ variable "context" {
6870
regex_replace_chars = null
6971
label_order = []
7072
id_length_limit = null
73+
label_key_case = null
74+
label_value_case = null
7175
}
7276
description = <<-EOT
7377
Single object for setting entire context at once.
@@ -76,6 +80,16 @@ variable "context" {
7680
Individual variable settings (non-null) override settings in context object,
7781
except for attributes, tags, and additional_tag_map, which are merged.
7882
EOT
83+
84+
validation {
85+
condition = var.context["label_key_case"] == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
86+
error_message = "Allowed values: `lower`, `title`, `upper`."
87+
}
88+
89+
validation {
90+
condition = var.context["label_value_case"] == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
91+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
92+
}
7993
}
8094

8195
variable "enabled" {
@@ -165,4 +179,33 @@ variable "id_length_limit" {
165179
EOT
166180
}
167181

182+
variable "label_key_case" {
183+
type = string
184+
default = null
185+
description = <<-EOT
186+
The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
187+
Possible values: `lower`, `title`, `upper`.
188+
Default value: `title`.
189+
EOT
190+
191+
validation {
192+
condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
193+
error_message = "Allowed values: `lower`, `title`, `upper`."
194+
}
195+
}
196+
197+
variable "label_value_case" {
198+
type = string
199+
default = null
200+
description = <<-EOT
201+
The letter case of output label values (also used in `tags` and `id`).
202+
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
203+
Default value: `lower`.
204+
EOT
205+
206+
validation {
207+
condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
208+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
209+
}
210+
}
168211
#### End of copy of cloudposse/terraform-null-label/variables.tf

docs/terraform.md

+4-2
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

99
## Providers
@@ -36,7 +36,7 @@
3636
| autoscale\_upper\_bound | Maximum level of autoscale metric to add an instance | `number` | `80` | no |
3737
| autoscale\_upper\_increment | How many Amazon EC2 instances to add when performing a scaling activity | `number` | `1` | no |
3838
| availability\_zone\_selector | Availability Zone selector | `string` | `"Any 2"` | no |
39-
| 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 |
39+
| 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> label_key_case = string<br> label_value_case = string<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_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 |
4040
| 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 |
4141
| deployment\_batch\_size | Percentage or fixed number of Amazon EC2 instances in the Auto Scaling group on which to simultaneously perform deployments. Valid values vary per deployment\_batch\_size\_type setting | `number` | `1` | no |
4242
| deployment\_batch\_size\_type | The type of number that is specified in deployment\_batch\_size\_type | `string` | `"Fixed"` | no |
@@ -66,7 +66,9 @@
6666
| instance\_refresh\_enabled | Enable weekly instance replacement. | `bool` | `true` | no |
6767
| instance\_type | Instances type | `string` | `"t2.micro"` | no |
6868
| keypair | Name of SSH key that will be deployed on Elastic Beanstalk and DataPipeline instance. The key should be present in AWS | `string` | `""` | no |
69+
| 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 |
6970
| 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 |
71+
| 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 |
7072
| loadbalancer\_certificate\_arn | Load Balancer SSL certificate ARN. The certificate must be present in AWS Certificate Manager | `string` | `""` | no |
7173
| loadbalancer\_crosszone | Configure the classic load balancer to route traffic evenly across all instances in all Availability Zones rather than only within each zone. | `bool` | `true` | no |
7274
| loadbalancer\_managed\_security\_group | Load balancer managed security group | `string` | `""` | no |

examples/complete/context.tf

+44-1
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.23.0" // requires Terraform >= 0.13.0
2424

2525
enabled = var.enabled
2626
namespace = var.namespace
@@ -54,6 +54,8 @@ variable "context" {
5454
regex_replace_chars = string
5555
label_order = list(string)
5656
id_length_limit = number
57+
label_key_case = string
58+
label_value_case = string
5759
})
5860
default = {
5961
enabled = true
@@ -68,6 +70,8 @@ variable "context" {
6870
regex_replace_chars = null
6971
label_order = []
7072
id_length_limit = null
73+
label_key_case = null
74+
label_value_case = null
7175
}
7276
description = <<-EOT
7377
Single object for setting entire context at once.
@@ -76,6 +80,16 @@ variable "context" {
7680
Individual variable settings (non-null) override settings in context object,
7781
except for attributes, tags, and additional_tag_map, which are merged.
7882
EOT
83+
84+
validation {
85+
condition = var.context["label_key_case"] == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
86+
error_message = "Allowed values: `lower`, `title`, `upper`."
87+
}
88+
89+
validation {
90+
condition = var.context["label_value_case"] == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
91+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
92+
}
7993
}
8094

8195
variable "enabled" {
@@ -165,4 +179,33 @@ variable "id_length_limit" {
165179
EOT
166180
}
167181

182+
variable "label_key_case" {
183+
type = string
184+
default = null
185+
description = <<-EOT
186+
The letter case of label keys (`tag` names) (i.e. `name`, `namespace`, `environment`, `stage`, `attributes`) to use in `tags`.
187+
Possible values: `lower`, `title`, `upper`.
188+
Default value: `title`.
189+
EOT
190+
191+
validation {
192+
condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
193+
error_message = "Allowed values: `lower`, `title`, `upper`."
194+
}
195+
}
196+
197+
variable "label_value_case" {
198+
type = string
199+
default = null
200+
description = <<-EOT
201+
The letter case of output label values (also used in `tags` and `id`).
202+
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
203+
Default value: `lower`.
204+
EOT
205+
206+
validation {
207+
condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
208+
error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
209+
}
210+
}
168211
#### End of copy of cloudposse/terraform-null-label/variables.tf

examples/complete/main.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ module "elastic_beanstalk_environment" {
7474
healthcheck_url = var.healthcheck_url
7575
application_port = var.application_port
7676

77-
// https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html
78-
// https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.docker
77+
# https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html
78+
# https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.docker
7979
solution_stack_name = var.solution_stack_name
8080

8181
additional_settings = var.additional_settings

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 = {

main.tf

+8-8
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ resource "aws_security_group" "default" {
320320
}
321321

322322
locals {
323-
// Remove `Name` tag from the map of tags because Elastic Beanstalk generates the `Name` tag automatically
324-
// and if it is provided, terraform tries to recreate the application on each `plan/apply`
325-
// `Namespace` should be removed as well since any string that contains `Name` forces recreation
326-
// https://github.com/terraform-providers/terraform-provider-aws/issues/3963
323+
# Remove `Name` tag from the map of tags because Elastic Beanstalk generates the `Name` tag automatically
324+
# and if it is provided, terraform tries to recreate the application on each `plan/apply`
325+
# `Namespace` should be removed as well since any string that contains `Name` forces recreation
326+
# https://github.com/terraform-providers/terraform-provider-aws/issues/3963
327327
tags = { for t in keys(module.this.tags) : t => module.this.tags[t] if t != "Name" && t != "Namespace" }
328328

329329
classic_elb_settings = [
@@ -862,8 +862,8 @@ resource "aws_elastic_beanstalk_environment" "default" {
862862
resource = ""
863863
}
864864

865-
// Add additional Elastic Beanstalk settings
866-
// For full list of options, see https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html
865+
# Add additional Elastic Beanstalk settings
866+
# For full list of options, see https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html
867867
dynamic "setting" {
868868
for_each = var.additional_settings
869869
content {
@@ -874,7 +874,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
874874
}
875875
}
876876

877-
// dynamic needed as "spot max price" should only have a value if it is defined.
877+
# dynamic needed as "spot max price" should only have a value if it is defined.
878878
dynamic "setting" {
879879
for_each = var.spot_max_price == -1 ? [] : [var.spot_max_price]
880880
content {
@@ -885,7 +885,7 @@ resource "aws_elastic_beanstalk_environment" "default" {
885885
}
886886
}
887887

888-
// Add environment variables if provided
888+
# Add environment variables if provided
889889
dynamic "setting" {
890890
for_each = var.env_vars
891891
content {

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)