Skip to content

Commit 86028cd

Browse files
srouaixSébastien Rouaixantonbabenko
authored
feat!: Upgrade AWS provider and min required Terraform version to 6.0 and 1.5.7 respectively (#73)
Co-authored-by: Sébastien Rouaix <[email protected]> Co-authored-by: Anton Babenko <[email protected]> Co-authored-by: Anton Babenko <[email protected]>
1 parent 457651a commit 86028cd

File tree

10 files changed

+46
-37
lines changed

10 files changed

+46
-37
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
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.96.3
3+
rev: v1.100.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each
@@ -24,7 +24,7 @@ repos:
2424
- '--args=--only=terraform_workspace_remote'
2525
- id: terraform_validate
2626
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v5.0.0
27+
rev: v6.0.0
2828
hooks:
2929
- id: check-merge-conflict
3030
- id: end-of-file-fixer

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ $ terraform apply
132132

133133
| Name | Version |
134134
|------|---------|
135-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.2 |
136-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61.0 |
135+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
136+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 |
137137

138138
## Providers
139139

140140
| Name | Version |
141141
|------|---------|
142-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61.0 |
142+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.0 |
143143

144144
## Modules
145145

@@ -209,6 +209,7 @@ No modules.
209209
| <a name="input_openid_connect_config"></a> [openid\_connect\_config](#input\_openid\_connect\_config) | Nested argument containing OpenID Connect configuration. | `map(string)` | `{}` | no |
210210
| <a name="input_opensearchservice_allowed_actions"></a> [opensearchservice\_allowed\_actions](#input\_opensearchservice\_allowed\_actions) | List of allowed IAM actions for datasources type AMAZON\_OPENSEARCH\_SERVICE | `list(string)` | <pre>[<br/> "es:ESHttpDelete",<br/> "es:ESHttpHead",<br/> "es:ESHttpGet",<br/> "es:ESHttpPost",<br/> "es:ESHttpPut"<br/>]</pre> | no |
211211
| <a name="input_query_depth_limit"></a> [query\_depth\_limit](#input\_query\_depth\_limit) | The maximum depth a query can have in a single request. | `number` | `null` | no |
212+
| <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 |
212213
| <a name="input_relational_database_allowed_actions"></a> [relational\_database\_allowed\_actions](#input\_relational\_database\_allowed\_actions) | List of allowed IAM actions for datasources type RELATIONAL\_DATABASE | `list(string)` | <pre>[<br/> "rds-data:BatchExecuteStatement",<br/> "rds-data:BeginTransaction",<br/> "rds-data:CommitTransaction",<br/> "rds-data:ExecuteStatement",<br/> "rds-data:RollbackTransaction"<br/>]</pre> | no |
213214
| <a name="input_resolver_caching_ttl"></a> [resolver\_caching\_ttl](#input\_resolver\_caching\_ttl) | Default caching TTL for resolvers when caching is enabled | `number` | `60` | no |
214215
| <a name="input_resolver_count_limit"></a> [resolver\_count\_limit](#input\_resolver\_count\_limit) | The maximum number of resolvers that can be invoked in a single request. | `number` | `null` | no |

examples/complete/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,22 @@ Note that this example may create resources which cost money. Run `terraform des
2020

2121
| Name | Version |
2222
|------|---------|
23-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
24-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.1 |
23+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.10 |
24+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.1 |
32-
| <a name="provider_aws.us-east-1"></a> [aws.us-east-1](#provider\_aws.us-east-1) | >= 5.1 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.0 |
3332
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.0 |
3433

3534
## Modules
3635

3736
| Name | Source | Version |
3837
|------|--------|---------|
39-
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 5.0 |
38+
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 6.0 |
4039
| <a name="module_appsync"></a> [appsync](#module\_appsync) | ../../ | n/a |
4140
| <a name="module_disabled"></a> [disabled](#module\_disabled) | ../../ | n/a |
4241

examples/complete/main.tf

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ provider "aws" {
1010
skip_requesting_account_id = false
1111
}
1212

13-
provider "aws" {
14-
region = "us-east-1"
15-
alias = "us-east-1"
16-
17-
# Make it faster by skipping something
18-
skip_metadata_api_check = true
19-
skip_region_validation = true
20-
skip_credentials_validation = true
21-
22-
# skip_requesting_account_id should be disabled to generate valid ARN in apigatewayv2_api_execution_arn
23-
skip_requesting_account_id = false
24-
}
25-
2613
locals {
2714
# Removing trailing dot from domain - just to be sure :)
2815
route53_domain_name = trimsuffix(var.route53_domain_name, ".")
@@ -52,16 +39,18 @@ resource "aws_route53_record" "api" {
5239
data "aws_acm_certificate" "existing_certificate" {
5340
count = var.use_existing_acm_certificate ? 1 : 0
5441

55-
domain = var.existing_acm_certificate_domain_name
42+
region = "us-east-1"
5643

57-
provider = aws.us-east-1
44+
domain = var.existing_acm_certificate_domain_name
5845
}
5946

6047
module "acm" {
6148
count = var.use_existing_acm_certificate ? 0 : 1
6249

50+
region = "us-east-1"
51+
6352
source = "terraform-aws-modules/acm/aws"
64-
version = "~> 5.0"
53+
version = "~> 6.0"
6554

6655
domain_name = local.route53_domain_name
6756
zone_id = try(data.aws_route53_zone.this[0].zone_id, aws_route53_zone.this[0].zone_id)
@@ -80,10 +69,6 @@ module "acm" {
8069
tags = {
8170
Name = local.route53_domain_name
8271
}
83-
84-
providers = {
85-
aws = aws.us-east-1
86-
}
8772
}
8873

8974
data "aws_caller_identity" "current" {}
@@ -158,7 +143,7 @@ module "appsync" {
158143
lambda = {
159144
authentication_type = "AWS_LAMBDA"
160145
lambda_authorizer_config = {
161-
authorizer_uri = "arn:aws:lambda:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:function:appsync_auth_2"
146+
authorizer_uri = "arn:aws:lambda:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:function:appsync_auth_2"
162147
}
163148
}
164149
}

examples/complete/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.0"
2+
required_version = ">= 1.10"
33

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

main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ locals {
99
resource "aws_appsync_graphql_api" "this" {
1010
count = var.create_graphql_api ? 1 : 0
1111

12+
region = var.region
13+
1214
name = var.name
1315
authentication_type = var.authentication_type
1416
schema = var.schema
@@ -116,6 +118,8 @@ resource "aws_appsync_graphql_api" "this" {
116118
resource "aws_appsync_domain_name" "this" {
117119
count = var.create_graphql_api && var.domain_name_association_enabled ? 1 : 0
118120

121+
region = var.region
122+
119123
domain_name = var.domain_name
120124
description = var.domain_name_description
121125
certificate_arn = var.certificate_arn
@@ -124,6 +128,8 @@ resource "aws_appsync_domain_name" "this" {
124128
resource "aws_appsync_domain_name_api_association" "this" {
125129
count = var.create_graphql_api && var.domain_name_association_enabled ? 1 : 0
126130

131+
region = var.region
132+
127133
api_id = aws_appsync_graphql_api.this[0].id
128134
domain_name = aws_appsync_domain_name.this[0].domain_name
129135
}
@@ -132,6 +138,8 @@ resource "aws_appsync_domain_name_api_association" "this" {
132138
resource "aws_appsync_api_cache" "this" {
133139
count = var.create_graphql_api && var.caching_enabled ? 1 : 0
134140

141+
region = var.region
142+
135143
api_id = aws_appsync_graphql_api.this[0].id
136144

137145
api_caching_behavior = var.caching_behavior
@@ -145,6 +153,8 @@ resource "aws_appsync_api_cache" "this" {
145153
resource "aws_appsync_api_key" "this" {
146154
for_each = var.create_graphql_api && var.authentication_type == "API_KEY" ? var.api_keys : {}
147155

156+
region = var.region
157+
148158
api_id = aws_appsync_graphql_api.this[0].id
149159
description = each.key
150160
expires = each.value
@@ -154,6 +164,8 @@ resource "aws_appsync_api_key" "this" {
154164
resource "aws_appsync_datasource" "this" {
155165
for_each = var.create_graphql_api ? var.datasources : {}
156166

167+
region = var.region
168+
157169
api_id = aws_appsync_graphql_api.this[0].id
158170
name = each.key
159171
type = each.value.type
@@ -233,6 +245,8 @@ resource "aws_appsync_datasource" "this" {
233245
resource "aws_appsync_resolver" "this" {
234246
for_each = local.resolvers
235247

248+
region = var.region
249+
236250
api_id = aws_appsync_graphql_api.this[0].id
237251
type = each.value.type
238252
field = each.value.field
@@ -280,6 +294,8 @@ resource "aws_appsync_resolver" "this" {
280294
resource "aws_appsync_function" "this" {
281295
for_each = { for k, v in var.functions : k => v if var.create_graphql_api == true }
282296

297+
region = var.region
298+
283299
api_id = aws_appsync_graphql_api.this[0].id
284300
data_source = lookup(each.value, "data_source", null)
285301
name = each.key

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,9 @@ variable "resolver_count_limit" {
350350
type = number
351351
default = null
352352
}
353+
354+
variable "region" {
355+
description = "Region where the resource(s) will be managed. Defaults to the region set in the provider configuration"
356+
type = string
357+
default = null
358+
}

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"
2+
required_version = ">= 1.5.7"
33

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

wrappers/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ module "wrapper" {
5959
log_exclude_verbose_content = try(each.value.log_exclude_verbose_content, var.defaults.log_exclude_verbose_content, false)
6060
log_field_log_level = try(each.value.log_field_log_level, var.defaults.log_field_log_level, null)
6161
logging_enabled = try(each.value.logging_enabled, var.defaults.logging_enabled, false)
62+
logs_role_description = try(each.value.logs_role_description, var.defaults.logs_role_description, null)
6263
logs_role_name = try(each.value.logs_role_name, var.defaults.logs_role_name, null)
6364
logs_role_tags = try(each.value.logs_role_tags, var.defaults.logs_role_tags, {})
6465
name = try(each.value.name, var.defaults.name, "")
6566
openid_connect_config = try(each.value.openid_connect_config, var.defaults.openid_connect_config, {})
6667
opensearchservice_allowed_actions = try(each.value.opensearchservice_allowed_actions, var.defaults.opensearchservice_allowed_actions, ["es:ESHttpDelete", "es:ESHttpHead", "es:ESHttpGet", "es:ESHttpPost", "es:ESHttpPut"])
6768
query_depth_limit = try(each.value.query_depth_limit, var.defaults.query_depth_limit, null)
69+
region = try(each.value.region, var.defaults.region, null)
6870
relational_database_allowed_actions = try(each.value.relational_database_allowed_actions, var.defaults.relational_database_allowed_actions, ["rds-data:BatchExecuteStatement", "rds-data:BeginTransaction", "rds-data:CommitTransaction", "rds-data:ExecuteStatement", "rds-data:RollbackTransaction"])
6971
resolver_caching_ttl = try(each.value.resolver_caching_ttl, var.defaults.resolver_caching_ttl, 60)
7072
resolver_count_limit = try(each.value.resolver_count_limit, var.defaults.resolver_count_limit, null)

wrappers/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"
2+
required_version = ">= 1.5.7"
33

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

0 commit comments

Comments
 (0)