Skip to content

Commit dc798ef

Browse files
authored
feat!: Upgrade AWS provider and min required Terraform version to 6.0 and 1.5.7 respectively (#147)
1 parent 2a3734b commit dc798ef

File tree

13 files changed

+59
-25
lines changed

13 files changed

+59
-25
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.103.0
3+
rev: v1.104.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ module "api_gateway" {
125125
```
126126

127127
This will create records that allow users to access the API Gateway using the following subdomains:
128+
128129
- `customer1.mydomain.com`
129130
- `customer2.mydomain.com`
130131

@@ -184,20 +185,20 @@ module "api_gateway" {
184185

185186
| Name | Version |
186187
|------|---------|
187-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
188-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.96 |
188+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
189+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 |
189190

190191
## Providers
191192

192193
| Name | Version |
193194
|------|---------|
194-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.96 |
195+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.0 |
195196

196197
## Modules
197198

198199
| Name | Source | Version |
199200
|------|--------|---------|
200-
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | 5.0.1 |
201+
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | 6.2.0 |
201202

202203
## Resources
203204

@@ -248,6 +249,7 @@ module "api_gateway" {
248249
| <a name="input_name"></a> [name](#input\_name) | The name of the API. Must be less than or equal to 128 characters in length | `string` | `""` | no |
249250
| <a name="input_private_zone"></a> [private\_zone](#input\_private\_zone) | Indicates the hosted zone being looked up is private. Certificate validation will fail if this is set to true. | `bool` | `false` | no |
250251
| <a name="input_protocol_type"></a> [protocol\_type](#input\_protocol\_type) | The API protocol. Valid values: `HTTP`, `WEBSOCKET` | `string` | `"HTTP"` | no |
252+
| <a name="input_region"></a> [region](#input\_region) | Region where the resource(s) will be managed. Defaults to the Region set in the provider configuration | `string` | `null` | no |
251253
| <a name="input_route_key"></a> [route\_key](#input\_route\_key) | Part of quick create. Specifies any route key. Applicable for HTTP APIs | `string` | `null` | no |
252254
| <a name="input_route_selection_expression"></a> [route\_selection\_expression](#input\_route\_selection\_expression) | The route selection expression for the API. Defaults to `$request.method $request.path` | `string` | `null` | no |
253255
| <a name="input_routes"></a> [routes](#input\_routes) | Map of API gateway routes with integrations | <pre>map(object({<br/> # Route<br/> authorizer_key = optional(string)<br/> api_key_required = optional(bool)<br/> authorization_scopes = optional(list(string), [])<br/> authorization_type = optional(string)<br/> authorizer_id = optional(string)<br/> model_selection_expression = optional(string)<br/> operation_name = optional(string)<br/> request_models = optional(map(string), {})<br/> request_parameter = optional(object({<br/> request_parameter_key = optional(string)<br/> required = optional(bool, false)<br/> }), {})<br/> route_response_selection_expression = optional(string)<br/><br/> # Route settings<br/> data_trace_enabled = optional(bool)<br/> detailed_metrics_enabled = optional(bool)<br/> logging_level = optional(string)<br/> throttling_burst_limit = optional(number)<br/> throttling_rate_limit = optional(number)<br/><br/> # Stage - Route response<br/> route_response = optional(object({<br/> create = optional(bool, false)<br/> model_selection_expression = optional(string)<br/> response_models = optional(map(string))<br/> route_response_key = optional(string, "$default")<br/> }), {})<br/><br/> # Integration<br/> integration = object({<br/> connection_id = optional(string)<br/> vpc_link_key = optional(string)<br/> connection_type = optional(string)<br/> content_handling_strategy = optional(string)<br/> credentials_arn = optional(string)<br/> description = optional(string)<br/> method = optional(string)<br/> subtype = optional(string)<br/> type = optional(string, "AWS_PROXY")<br/> uri = optional(string)<br/> passthrough_behavior = optional(string)<br/> payload_format_version = optional(string)<br/> request_parameters = optional(map(string), {})<br/> request_templates = optional(map(string), {})<br/> response_parameters = optional(list(object({<br/> mappings = map(string)<br/> status_code = string<br/> })))<br/> template_selection_expression = optional(string)<br/> timeout_milliseconds = optional(number)<br/> tls_config = optional(object({<br/> server_name_to_verify = optional(string)<br/> }))<br/><br/> # Integration Response<br/> response = optional(object({<br/> content_handling_strategy = optional(string)<br/> integration_response_key = optional(string)<br/> response_templates = optional(map(string))<br/> template_selection_expression = optional(string)<br/> }), {})<br/> })<br/> }))</pre> | `{}` | no |

examples/complete-http/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Note that this example may create resources which cost money. Run `terraform des
1919

2020
| Name | Version |
2121
|------|---------|
22-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.96 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 |
2424
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 2.5 |
2525
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2626
| <a name="requirement_tls"></a> [tls](#requirement\_tls) | >= 3.1 |
@@ -29,7 +29,7 @@ Note that this example may create resources which cost money. Run `terraform des
2929

3030
| Name | Version |
3131
|------|---------|
32-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.96 |
32+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.0 |
3333
| <a name="provider_local"></a> [local](#provider\_local) | >= 2.5 |
3434
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3535
| <a name="provider_tls"></a> [tls](#provider\_tls) | >= 3.1 |

examples/complete-http/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 1.3"
2+
required_version = ">= 1.5.7"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.96"
7+
version = ">= 6.0"
88
}
99
local = {
1010
source = "hashicorp/local"

examples/vpc-link-http/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Note that this example may create resources which cost money. Run `terraform des
1919

2020
| Name | Version |
2121
|------|---------|
22-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.96 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 |
2424
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.96 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.0 |
3131
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3232

3333
## Modules

examples/vpc-link-http/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 1.3"
2+
required_version = ">= 1.5.7"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.96"
7+
version = ">= 6.0"
88
}
99
null = {
1010
source = "hashicorp/null"

examples/websocket/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ connected (press CTRL+C to quit)
5050

5151
| Name | Version |
5252
|------|---------|
53-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
54-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.96 |
53+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
54+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 |
5555

5656
## Providers
5757

examples/websocket/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 1.3"
2+
required_version = ">= 1.5.7"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.96"
7+
version = ">= 6.0"
88
}
99
}
1010
}

main.tf

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ locals {
1212
resource "aws_apigatewayv2_api" "this" {
1313
count = var.create ? 1 : 0
1414

15+
region = var.region
16+
1517
api_key_selection_expression = local.is_websocket ? var.api_key_selection_expression : null
1618
body = local.is_http ? var.body : null
1719

@@ -54,6 +56,8 @@ resource "aws_apigatewayv2_api" "this" {
5456
resource "aws_apigatewayv2_authorizer" "this" {
5557
for_each = { for k, v in var.authorizers : k => v if var.create }
5658

59+
region = var.region
60+
5761
api_id = aws_apigatewayv2_api.this[0].id
5862

5963
authorizer_credentials_arn = each.value.authorizer_credentials_arn
@@ -87,6 +91,8 @@ locals {
8791
resource "aws_apigatewayv2_domain_name" "this" {
8892
count = local.create_domain_name ? 1 : 0
8993

94+
region = var.region
95+
9096
domain_name = var.domain_name
9197

9298
domain_name_configuration {
@@ -112,6 +118,8 @@ resource "aws_apigatewayv2_domain_name" "this" {
112118
resource "aws_apigatewayv2_api_mapping" "this" {
113119
count = local.create_domain_name && local.create_stage ? 1 : 0
114120

121+
region = var.region
122+
115123
api_id = aws_apigatewayv2_api.this[0].id
116124
api_mapping_key = var.api_mapping_key
117125
domain_name = aws_apigatewayv2_domain_name.this[0].id
@@ -166,7 +174,9 @@ locals {
166174

167175
module "acm" {
168176
source = "terraform-aws-modules/acm/aws"
169-
version = "5.0.1"
177+
version = "6.2.0"
178+
179+
region = var.region
170180

171181
create_certificate = local.create_domain_name && var.create_domain_records && local.create_certificate
172182

@@ -186,6 +196,8 @@ module "acm" {
186196
resource "aws_apigatewayv2_route" "this" {
187197
for_each = { for k, v in var.routes : k => v if local.create_routes_and_integrations }
188198

199+
region = var.region
200+
189201
api_id = aws_apigatewayv2_api.this[0].id
190202

191203
api_key_required = local.is_websocket ? each.value.api_key_required : null
@@ -217,6 +229,8 @@ resource "aws_apigatewayv2_route" "this" {
217229
resource "aws_apigatewayv2_route_response" "this" {
218230
for_each = { for k, v in var.routes : k => v if local.create_routes_and_integrations && coalesce(v.route_response.create, false) }
219231

232+
region = var.region
233+
220234
api_id = aws_apigatewayv2_api.this[0].id
221235
model_selection_expression = each.value.route_response.model_selection_expression
222236
response_models = each.value.route_response.response_models
@@ -231,8 +245,9 @@ resource "aws_apigatewayv2_route_response" "this" {
231245
resource "aws_apigatewayv2_integration" "this" {
232246
for_each = { for k, v in var.routes : k => v.integration if local.create_routes_and_integrations }
233247

234-
api_id = aws_apigatewayv2_api.this[0].id
248+
region = var.region
235249

250+
api_id = aws_apigatewayv2_api.this[0].id
236251
connection_id = try(aws_apigatewayv2_vpc_link.this[each.value.vpc_link_key].id, each.value.connection_id)
237252
connection_type = each.value.connection_type
238253
content_handling_strategy = each.value.content_handling_strategy
@@ -279,6 +294,8 @@ resource "aws_apigatewayv2_integration" "this" {
279294
resource "aws_apigatewayv2_integration_response" "this" {
280295
for_each = { for k, v in var.routes : k => v.integration if local.create_routes_and_integrations && v.integration.response.integration_response_key != null }
281296

297+
region = var.region
298+
282299
api_id = aws_apigatewayv2_api.this[0].id
283300
integration_id = aws_apigatewayv2_integration.this[each.key].id
284301

@@ -324,6 +341,8 @@ locals {
324341
resource "aws_apigatewayv2_stage" "this" {
325342
count = local.create_stage ? 1 : 0
326343

344+
region = var.region
345+
327346
api_id = aws_apigatewayv2_api.this[0].id
328347

329348
dynamic "access_log_settings" {
@@ -383,6 +402,8 @@ resource "aws_apigatewayv2_stage" "this" {
383402
resource "aws_apigatewayv2_deployment" "this" {
384403
count = local.create_stage && var.deploy_stage && !local.is_http ? 1 : 0
385404

405+
region = var.region
406+
386407
api_id = aws_apigatewayv2_api.this[0].id
387408
description = var.description
388409

@@ -414,6 +435,8 @@ resource "aws_apigatewayv2_deployment" "this" {
414435
resource "aws_cloudwatch_log_group" "this" {
415436
for_each = { for k, v in { "this" = var.stage_access_log_settings } : k => v if local.create_stage && v != null && try(v.create_log_group, true) }
416437

438+
region = var.region
439+
417440
name = coalesce(each.value.log_group_name, "/aws/apigateway/${var.name}/${replace(var.stage_name, "$", "")}")
418441
retention_in_days = each.value.log_group_retention_in_days
419442
kms_key_id = each.value.log_group_kms_key_id
@@ -430,6 +453,8 @@ resource "aws_cloudwatch_log_group" "this" {
430453
resource "aws_apigatewayv2_vpc_link" "this" {
431454
for_each = { for k, v in var.vpc_links : k => v if var.create }
432455

456+
region = var.region
457+
433458
name = coalesce(each.value.name, each.key)
434459
security_group_ids = each.value.security_group_ids
435460
subnet_ids = each.value.subnet_ids

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ variable "create" {
44
default = true
55
}
66

7+
variable "region" {
8+
description = "Region where the resource(s) will be managed. Defaults to the Region set in the provider configuration"
9+
type = string
10+
default = null
11+
}
12+
713
variable "tags" {
814
description = "A mapping of tags to assign to API gateway resources"
915
type = map(string)

0 commit comments

Comments
 (0)