Skip to content

Commit 27f69b1

Browse files
authored
Support AWS Provider V5 (#142)
* Support AWS Provider V5 * Support AWS Provider V5 * Support AWS Provider V5 * bump s3 * bump s3 * bump s3 * precommit/terraform * bump logs * bump logs * bump logs * bump logs
1 parent 0152162 commit 27f69b1

File tree

9 files changed

+37
-68
lines changed

9 files changed

+37
-68
lines changed

.github/workflows/release-branch.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'docs/**'
1111
- 'examples/**'
1212
- 'test/**'
13+
- 'README.*'
1314

1415
permissions:
1516
contents: write

.github/workflows/release-published.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ permissions:
1111

1212
jobs:
1313
terraform-module:
14-
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
14+
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-published.yml@main

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Available targets:
216216

217217
| Name | Source | Version |
218218
|------|--------|---------|
219-
| <a name="module_access_logs"></a> [access\_logs](#module\_access\_logs) | cloudposse/lb-s3-bucket/aws | 0.16.0 |
219+
| <a name="module_access_logs"></a> [access\_logs](#module\_access\_logs) | cloudposse/lb-s3-bucket/aws | 0.18.0 |
220220
| <a name="module_default_load_balancer_label"></a> [default\_load\_balancer\_label](#module\_default\_load\_balancer\_label) | cloudposse/label/null | 0.25.0 |
221221
| <a name="module_default_target_group_label"></a> [default\_target\_group\_label](#module\_default\_target\_group\_label) | cloudposse/label/null | 0.25.0 |
222222
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
@@ -246,7 +246,6 @@ Available targets:
246246
| <a name="input_additional_certs"></a> [additional\_certs](#input\_additional\_certs) | A list of additonal certs to add to the https listerner | `list(string)` | `[]` | no |
247247
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
248248
| <a name="input_alb_access_logs_s3_bucket_force_destroy"></a> [alb\_access\_logs\_s3\_bucket\_force\_destroy](#input\_alb\_access\_logs\_s3\_bucket\_force\_destroy) | A boolean that indicates all objects should be deleted from the ALB access logs S3 bucket so that the bucket can be destroyed without error | `bool` | `false` | no |
249-
| <a name="input_alb_access_logs_s3_bucket_force_destroy_enabled"></a> [alb\_access\_logs\_s3\_bucket\_force\_destroy\_enabled](#input\_alb\_access\_logs\_s3\_bucket\_force\_destroy\_enabled) | When `true`, permits `force_destroy` to be set to `true`.<br>This is an extra safety precaution to reduce the chance that Terraform will destroy and recreate<br>your S3 bucket, causing COMPLETE LOSS OF ALL DATA even if it was stored in Glacier.<br>WARNING: Upgrading this module from a version prior to 0.27.0 to this version<br> will cause Terraform to delete your existing S3 bucket CAUSING COMPLETE DATA LOSS<br> unless you follow the upgrade instructions on the Wiki [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS)).<br> See additional instructions for upgrading from v0.27.0 to v0.28.0 [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.28.0-and-AWS-provider-v4-(POTENTIAL-DATA-LOSS)). | `bool` | `false` | no |
250249
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
251250
| <a name="input_certificate_arn"></a> [certificate\_arn](#input\_certificate\_arn) | The ARN of the default SSL certificate for HTTPS listener | `string` | `""` | no |
252251
| <a name="input_context"></a> [context](#input\_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> "descriptor_formats": {},<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> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |

docs/terraform.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
| Name | Source | Version |
1818
|------|--------|---------|
19-
| <a name="module_access_logs"></a> [access\_logs](#module\_access\_logs) | cloudposse/lb-s3-bucket/aws | 0.16.0 |
19+
| <a name="module_access_logs"></a> [access\_logs](#module\_access\_logs) | cloudposse/lb-s3-bucket/aws | 0.18.0 |
2020
| <a name="module_default_load_balancer_label"></a> [default\_load\_balancer\_label](#module\_default\_load\_balancer\_label) | cloudposse/label/null | 0.25.0 |
2121
| <a name="module_default_target_group_label"></a> [default\_target\_group\_label](#module\_default\_target\_group\_label) | cloudposse/label/null | 0.25.0 |
2222
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
@@ -46,7 +46,6 @@
4646
| <a name="input_additional_certs"></a> [additional\_certs](#input\_additional\_certs) | A list of additonal certs to add to the https listerner | `list(string)` | `[]` | no |
4747
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
4848
| <a name="input_alb_access_logs_s3_bucket_force_destroy"></a> [alb\_access\_logs\_s3\_bucket\_force\_destroy](#input\_alb\_access\_logs\_s3\_bucket\_force\_destroy) | A boolean that indicates all objects should be deleted from the ALB access logs S3 bucket so that the bucket can be destroyed without error | `bool` | `false` | no |
49-
| <a name="input_alb_access_logs_s3_bucket_force_destroy_enabled"></a> [alb\_access\_logs\_s3\_bucket\_force\_destroy\_enabled](#input\_alb\_access\_logs\_s3\_bucket\_force\_destroy\_enabled) | When `true`, permits `force_destroy` to be set to `true`.<br>This is an extra safety precaution to reduce the chance that Terraform will destroy and recreate<br>your S3 bucket, causing COMPLETE LOSS OF ALL DATA even if it was stored in Glacier.<br>WARNING: Upgrading this module from a version prior to 0.27.0 to this version<br> will cause Terraform to delete your existing S3 bucket CAUSING COMPLETE DATA LOSS<br> unless you follow the upgrade instructions on the Wiki [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS)).<br> See additional instructions for upgrading from v0.27.0 to v0.28.0 [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.28.0-and-AWS-provider-v4-(POTENTIAL-DATA-LOSS)). | `bool` | `false` | no |
5049
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
5150
| <a name="input_certificate_arn"></a> [certificate\_arn](#input\_certificate\_arn) | The ARN of the default SSL certificate for HTTPS listener | `string` | `""` | no |
5251
| <a name="input_context"></a> [context](#input\_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> "descriptor_formats": {},<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> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |

examples/complete/main.tf

+8-9
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ provider "aws" {
33
}
44

55
module "vpc" {
6-
source = "cloudposse/vpc/aws"
7-
version = "0.28.1"
8-
cidr_block = var.vpc_cidr_block
9-
context = module.this.context
6+
source = "cloudposse/vpc/aws"
7+
version = "2.1.0"
8+
ipv4_primary_cidr_block = var.vpc_cidr_block
9+
context = module.this.context
1010
}
1111

1212
module "subnets" {
1313
source = "cloudposse/dynamic-subnets/aws"
14-
version = "0.39.8"
14+
version = "2.3.0"
1515
availability_zones = var.availability_zones
1616
vpc_id = module.vpc.vpc_id
17-
igw_id = module.vpc.igw_id
18-
cidr_block = module.vpc.vpc_cidr_block
17+
igw_id = [module.vpc.igw_id]
18+
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
1919
nat_gateway_enabled = false
2020
nat_instance_enabled = false
2121
context = module.this.context
@@ -46,8 +46,7 @@ module "alb" {
4646
target_group_target_type = var.target_group_target_type
4747
stickiness = var.stickiness
4848

49-
alb_access_logs_s3_bucket_force_destroy = var.alb_access_logs_s3_bucket_force_destroy
50-
alb_access_logs_s3_bucket_force_destroy_enabled = var.alb_access_logs_s3_bucket_force_destroy_enabled
49+
alb_access_logs_s3_bucket_force_destroy = var.alb_access_logs_s3_bucket_force_destroy
5150

5251
context = module.this.context
5352
}

examples/complete/variables.tf

-13
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,6 @@ variable "alb_access_logs_s3_bucket_force_destroy" {
9898
description = "A boolean that indicates all objects should be deleted from the ALB access logs S3 bucket so that the bucket can be destroyed without error"
9999
}
100100

101-
variable "alb_access_logs_s3_bucket_force_destroy_enabled" {
102-
type = bool
103-
description = <<-EOT
104-
When `true`, permits `force_destroy` to be set to `true`.
105-
This is an extra safety precaution to reduce the chance that Terraform will destroy and recreate
106-
your S3 bucket, causing COMPLETE LOSS OF ALL DATA even if it was stored in Glacier.
107-
WARNING: Upgrading this module from a version prior to 0.27.0 to this version
108-
will cause Terraform to delete your existing S3 bucket CAUSING COMPLETE DATA LOSS
109-
unless you follow the upgrade instructions on the Wiki [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS)).
110-
See additional instructions for upgrading from v0.27.0 to v0.28.0 [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.28.0-and-AWS-provider-v4-(POTENTIAL-DATA-LOSS)).
111-
EOT
112-
}
113-
114101
variable "target_group_port" {
115102
type = number
116103
description = "The port for the default target group"

main.tf

+13-15
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resource "aws_security_group_rule" "egress" {
1313
to_port = "0"
1414
protocol = "-1"
1515
cidr_blocks = ["0.0.0.0/0"]
16-
security_group_id = join("", aws_security_group.default.*.id)
16+
security_group_id = one(aws_security_group.default[*].id)
1717
}
1818

1919
resource "aws_security_group_rule" "http_ingress" {
@@ -24,7 +24,7 @@ resource "aws_security_group_rule" "http_ingress" {
2424
protocol = "tcp"
2525
cidr_blocks = var.http_ingress_cidr_blocks
2626
prefix_list_ids = var.http_ingress_prefix_list_ids
27-
security_group_id = join("", aws_security_group.default.*.id)
27+
security_group_id = one(aws_security_group.default[*].id)
2828
}
2929

3030
resource "aws_security_group_rule" "https_ingress" {
@@ -35,22 +35,20 @@ resource "aws_security_group_rule" "https_ingress" {
3535
protocol = "tcp"
3636
cidr_blocks = var.https_ingress_cidr_blocks
3737
prefix_list_ids = var.https_ingress_prefix_list_ids
38-
security_group_id = join("", aws_security_group.default.*.id)
38+
security_group_id = one(aws_security_group.default[*].id)
3939
}
4040

4141
module "access_logs" {
4242
source = "cloudposse/lb-s3-bucket/aws"
43-
version = "0.16.0"
43+
version = "0.18.0"
4444

4545
enabled = module.this.enabled && var.access_logs_enabled && var.access_logs_s3_bucket_id == null
4646

4747
attributes = compact(concat(module.this.attributes, ["alb", "access", "logs"]))
4848

4949
force_destroy = var.alb_access_logs_s3_bucket_force_destroy
50-
force_destroy_enabled = var.alb_access_logs_s3_bucket_force_destroy_enabled
5150
lifecycle_configuration_rules = var.lifecycle_configuration_rules
5251

53-
# TODO: deprecate these inputs in favor of `lifecycle_configuration_rules`
5452
lifecycle_rule_enabled = var.lifecycle_rule_enabled
5553
enable_glacier_transition = var.enable_glacier_transition
5654
expiration_days = var.expiration_days
@@ -79,7 +77,7 @@ resource "aws_lb" "default" {
7977
load_balancer_type = "application"
8078

8179
security_groups = compact(
82-
concat(var.security_group_ids, [join("", aws_security_group.default.*.id)]),
80+
concat(var.security_group_ids, [one(aws_security_group.default[*].id)]),
8381
)
8482

8583
subnets = var.subnet_ids
@@ -152,13 +150,13 @@ resource "aws_lb_listener" "http_forward" {
152150
#bridgecrew:skip=BC_AWS_GENERAL_43 - Skipping Ensure that load balancer is using TLS 1.2.
153151
#bridgecrew:skip=BC_AWS_NETWORKING_29 - Skipping Ensure ALB Protocol is HTTPS
154152
count = module.this.enabled && var.http_enabled && var.http_redirect != true ? 1 : 0
155-
load_balancer_arn = join("", aws_lb.default.*.arn)
153+
load_balancer_arn = one(aws_lb.default[*].arn)
156154
port = var.http_port
157155
protocol = "HTTP"
158156
tags = merge(module.this.tags, var.listener_additional_tags)
159157

160158
default_action {
161-
target_group_arn = var.listener_http_fixed_response != null ? null : join("", aws_lb_target_group.default.*.arn)
159+
target_group_arn = var.listener_http_fixed_response != null ? null : one(aws_lb_target_group.default[*].arn)
162160
type = var.listener_http_fixed_response != null ? "fixed-response" : "forward"
163161

164162
dynamic "fixed_response" {
@@ -174,13 +172,13 @@ resource "aws_lb_listener" "http_forward" {
174172

175173
resource "aws_lb_listener" "http_redirect" {
176174
count = module.this.enabled && var.http_enabled && var.http_redirect == true ? 1 : 0
177-
load_balancer_arn = join("", aws_lb.default.*.arn)
175+
load_balancer_arn = one(aws_lb.default[*].arn)
178176
port = var.http_port
179177
protocol = "HTTP"
180178
tags = merge(module.this.tags, var.listener_additional_tags)
181179

182180
default_action {
183-
target_group_arn = join("", aws_lb_target_group.default.*.arn)
181+
target_group_arn = one(aws_lb_target_group.default[*].arn)
184182
type = "redirect"
185183

186184
redirect {
@@ -194,7 +192,7 @@ resource "aws_lb_listener" "http_redirect" {
194192
resource "aws_lb_listener" "https" {
195193
#bridgecrew:skip=BC_AWS_GENERAL_43 - Skipping Ensure that load balancer is using TLS 1.2.
196194
count = module.this.enabled && var.https_enabled ? 1 : 0
197-
load_balancer_arn = join("", aws_lb.default.*.arn)
195+
load_balancer_arn = one(aws_lb.default[*].arn)
198196

199197
port = var.https_port
200198
protocol = "HTTPS"
@@ -203,7 +201,7 @@ resource "aws_lb_listener" "https" {
203201
tags = merge(module.this.tags, var.listener_additional_tags)
204202

205203
default_action {
206-
target_group_arn = var.listener_https_fixed_response != null ? null : join("", aws_lb_target_group.default.*.arn)
204+
target_group_arn = var.listener_https_fixed_response != null ? null : one(aws_lb_target_group.default[*].arn)
207205
type = var.listener_https_fixed_response != null ? "fixed-response" : "forward"
208206

209207
dynamic "fixed_response" {
@@ -218,7 +216,7 @@ resource "aws_lb_listener" "https" {
218216
}
219217

220218
resource "aws_lb_listener_certificate" "https_sni" {
221-
count = module.this.enabled && var.https_enabled && var.additional_certs != [] ? length(var.additional_certs) : 0
222-
listener_arn = join("", aws_lb_listener.https.*.arn)
219+
count = module.this.enabled && var.https_enabled && length(var.additional_certs) > 0 ? length(var.additional_certs) : 0
220+
listener_arn = one(aws_lb_listener.https[*].arn)
223221
certificate_arn = var.additional_certs[count.index]
224222
}

outputs.tf

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
output "alb_name" {
22
description = "The ARN suffix of the ALB"
3-
value = join("", aws_lb.default.*.name)
3+
value = one(aws_lb.default[*].name)
44
}
55

66
output "alb_arn" {
77
description = "The ARN of the ALB"
8-
value = join("", aws_lb.default.*.arn)
8+
value = one(aws_lb.default[*].arn)
99
}
1010

1111
output "alb_arn_suffix" {
1212
description = "The ARN suffix of the ALB"
13-
value = join("", aws_lb.default.*.arn_suffix)
13+
value = one(aws_lb.default[*].arn_suffix)
1414
}
1515

1616
output "alb_dns_name" {
1717
description = "DNS name of ALB"
18-
value = join("", aws_lb.default.*.dns_name)
18+
value = one(aws_lb.default[*].dns_name)
1919
}
2020

2121
output "alb_zone_id" {
2222
description = "The ID of the zone which ALB is provisioned"
23-
value = join("", aws_lb.default.*.zone_id)
23+
value = one(aws_lb.default[*].zone_id)
2424
}
2525

2626
output "security_group_id" {
2727
description = "The security group ID of the ALB"
28-
value = join("", aws_security_group.default.*.id)
28+
value = one(aws_security_group.default[*].id)
2929
}
3030

3131
output "default_target_group_arn" {
3232
description = "The default target group ARN"
33-
value = join("", aws_lb_target_group.default.*.arn)
33+
value = one(aws_lb_target_group.default[*].arn)
3434
}
3535

3636
output "default_target_group_arn_suffix" {
3737
description = "The default target group ARN suffix"
38-
value = join("", aws_lb_target_group.default.*.arn_suffix)
38+
value = one(aws_lb_target_group.default[*].arn_suffix)
3939
}
4040

4141
output "http_listener_arn" {
4242
description = "The ARN of the HTTP forwarding listener"
43-
value = join("", aws_lb_listener.http_forward.*.arn)
43+
value = one(aws_lb_listener.http_forward[*].arn)
4444
}
4545

4646
output "http_redirect_listener_arn" {
4747
description = "The ARN of the HTTP to HTTPS redirect listener"
48-
value = join("", aws_lb_listener.http_redirect.*.arn)
48+
value = one(aws_lb_listener.http_redirect[*].arn)
4949
}
5050

5151
output "https_listener_arn" {
5252
description = "The ARN of the HTTPS listener"
53-
value = join("", aws_lb_listener.https.*.arn)
53+
value = one(aws_lb_listener.https[*].arn)
5454
}
5555

5656
output "listener_arns" {
5757
description = "A list of all the listener ARNs"
5858
value = compact(
59-
concat(aws_lb_listener.http_forward.*.arn, aws_lb_listener.http_redirect.*.arn, aws_lb_listener.https.*.arn)
59+
concat(aws_lb_listener.http_forward[*].arn, aws_lb_listener.http_redirect[*].arn, aws_lb_listener.https[*].arn)
6060
)
6161
}
6262

variables.tf

-14
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,6 @@ variable "alb_access_logs_s3_bucket_force_destroy" {
206206
description = "A boolean that indicates all objects should be deleted from the ALB access logs S3 bucket so that the bucket can be destroyed without error"
207207
}
208208

209-
variable "alb_access_logs_s3_bucket_force_destroy_enabled" {
210-
type = bool
211-
default = false
212-
description = <<-EOT
213-
When `true`, permits `force_destroy` to be set to `true`.
214-
This is an extra safety precaution to reduce the chance that Terraform will destroy and recreate
215-
your S3 bucket, causing COMPLETE LOSS OF ALL DATA even if it was stored in Glacier.
216-
WARNING: Upgrading this module from a version prior to 0.27.0 to this version
217-
will cause Terraform to delete your existing S3 bucket CAUSING COMPLETE DATA LOSS
218-
unless you follow the upgrade instructions on the Wiki [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS)).
219-
See additional instructions for upgrading from v0.27.0 to v0.28.0 [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.28.0-and-AWS-provider-v4-(POTENTIAL-DATA-LOSS)).
220-
EOT
221-
}
222-
223209
variable "target_group_port" {
224210
type = number
225211
default = 80

0 commit comments

Comments
 (0)