From f5360f1dd4f2d69410c325eb60d3694d985ffccd Mon Sep 17 00:00:00 2001 From: Guillaume Lecerf Date: Mon, 23 Jun 2025 15:09:38 +0200 Subject: [PATCH 1/3] feat!: Handle new region parameter introduced in terraform-aws 6.0 --- README.md | 5 +++-- main.tf | 2 ++ variables.tf | 6 ++++++ versions.tf | 2 +- wrappers/main.tf | 1 + wrappers/versions.tf | 2 +- 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f544d7a..35affb1 100644 --- a/README.md +++ b/README.md @@ -180,13 +180,13 @@ module "acm" { | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.40 | +| [aws](#requirement\_aws) | >= 6.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.40 | +| [aws](#provider\_aws) | >= 6.0 | ## Modules @@ -215,6 +215,7 @@ No modules. | [key\_algorithm](#input\_key\_algorithm) | Specifies the algorithm of the public and private key pair that your Amazon issued certificate uses to encrypt data | `string` | `null` | no | | [private\_authority\_arn](#input\_private\_authority\_arn) | Private Certificate Authority ARN for issuing private certificates | `string` | `null` | no | | [putin\_khuylo](#input\_putin\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no | +| [region](#input\_region) | Region to create the resources into | `string` | `null` | no | | [subject\_alternative\_names](#input\_subject\_alternative\_names) | A list of domains that should be SANs in the issued certificate | `list(string)` | `[]` | no | | [tags](#input\_tags) | A mapping of tags to assign to the resource | `map(string)` | `{}` | no | | [validate\_certificate](#input\_validate\_certificate) | Whether to validate certificate by creating Route53 record | `bool` | `true` | no | diff --git a/main.tf b/main.tf index 68f3f1b..c376925 100644 --- a/main.tf +++ b/main.tf @@ -23,6 +23,7 @@ resource "aws_acm_certificate" "this" { subject_alternative_names = var.subject_alternative_names validation_method = var.validation_method key_algorithm = var.key_algorithm + region = var.region certificate_authority_arn = var.private_authority_arn @@ -67,6 +68,7 @@ resource "aws_acm_certificate_validation" "this" { count = local.create_certificate && var.validation_method != null && var.validate_certificate && var.wait_for_validation ? 1 : 0 certificate_arn = aws_acm_certificate.this[0].arn + region = var.region validation_record_fqdns = flatten([aws_route53_record.validation[*].fqdn, var.validation_record_fqdns]) diff --git a/variables.tf b/variables.tf index e53d33f..1d1dc18 100644 --- a/variables.tf +++ b/variables.tf @@ -46,6 +46,12 @@ variable "domain_name" { default = "" } +variable "region" { + description = "Region to create the resources into" + type = string + default = null +} + variable "subject_alternative_names" { description = "A list of domains that should be SANs in the issued certificate" type = list(string) diff --git a/versions.tf b/versions.tf index fa875db..aaf26b8 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.40" + version = ">= 6.0" } } } diff --git a/wrappers/main.tf b/wrappers/main.tf index b54571f..811de3a 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -14,6 +14,7 @@ module "wrapper" { key_algorithm = try(each.value.key_algorithm, var.defaults.key_algorithm, null) private_authority_arn = try(each.value.private_authority_arn, var.defaults.private_authority_arn, null) putin_khuylo = try(each.value.putin_khuylo, var.defaults.putin_khuylo, true) + region = try(each.value.region, var.defaults.region, null) subject_alternative_names = try(each.value.subject_alternative_names, var.defaults.subject_alternative_names, []) tags = try(each.value.tags, var.defaults.tags, {}) validate_certificate = try(each.value.validate_certificate, var.defaults.validate_certificate, true) diff --git a/wrappers/versions.tf b/wrappers/versions.tf index fa875db..aaf26b8 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.40" + version = ">= 6.0" } } } From 93742d3cc0e7ab405362336b2f8e09857231b71e Mon Sep 17 00:00:00 2001 From: Guillaume Lecerf Date: Mon, 23 Jun 2025 17:28:47 +0200 Subject: [PATCH 2/3] build!: Bump terraform required version to 1.10.0 to be able to use new features (optional variable attributes, ephemeral values...) --- README.md | 2 +- versions.tf | 2 +- wrappers/versions.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 35affb1..c23fcb6 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ module "acm" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | +| [terraform](#requirement\_terraform) | >= 1.10.0 | | [aws](#requirement\_aws) | >= 6.0 | ## Providers diff --git a/versions.tf b/versions.tf index aaf26b8..312f346 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.10.0" required_providers { aws = { diff --git a/wrappers/versions.tf b/wrappers/versions.tf index aaf26b8..312f346 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.10.0" required_providers { aws = { From 02cbfb3628a714a8a2ffda2f1c25b80314124117 Mon Sep 17 00:00:00 2001 From: Bryant Biggs Date: Mon, 23 Jun 2025 10:59:17 -0500 Subject: [PATCH 3/3] fix: Bump version throughout, fix example --- .pre-commit-config.yaml | 2 +- README.md | 2 +- .../complete-dns-validation-with-cloudflare/README.md | 4 ++-- examples/complete-dns-validation-with-cloudflare/main.tf | 8 ++++++++ .../complete-dns-validation-with-cloudflare/versions.tf | 4 ++-- examples/complete-dns-validation/README.md | 6 +++--- examples/complete-dns-validation/versions.tf | 4 ++-- .../README.md | 6 +++--- .../versions.tf | 4 ++-- examples/complete-email-validation/README.md | 6 +++--- examples/complete-email-validation/versions.tf | 4 ++-- versions.tf | 2 +- wrappers/versions.tf | 2 +- 13 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7e4e7da..b84d048 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.96.1 + rev: v1.99.4 hooks: - id: terraform_fmt - id: terraform_wrapper_module_for_each diff --git a/README.md b/README.md index c23fcb6..03c2895 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ module "acm" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.10.0 | +| [terraform](#requirement\_terraform) | >= 1.10 | | [aws](#requirement\_aws) | >= 6.0 | ## Providers diff --git a/examples/complete-dns-validation-with-cloudflare/README.md b/examples/complete-dns-validation-with-cloudflare/README.md index 69179c1..af8e3f1 100644 --- a/examples/complete-dns-validation-with-cloudflare/README.md +++ b/examples/complete-dns-validation-with-cloudflare/README.md @@ -23,8 +23,8 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.40 | +| [terraform](#requirement\_terraform) | >= 1.10 | +| [aws](#requirement\_aws) | >= 6.0 | | [cloudflare](#requirement\_cloudflare) | >= 3.4, <=3.32 | ## Providers diff --git a/examples/complete-dns-validation-with-cloudflare/main.tf b/examples/complete-dns-validation-with-cloudflare/main.tf index 157b628..c309692 100644 --- a/examples/complete-dns-validation-with-cloudflare/main.tf +++ b/examples/complete-dns-validation-with-cloudflare/main.tf @@ -5,6 +5,14 @@ locals { domain_name = trimsuffix(local.domain, ".") } +provider "aws" { + alias = "route53" +} + +provider "aws" { + alias = "acm" +} + module "acm" { source = "../../" diff --git a/examples/complete-dns-validation-with-cloudflare/versions.tf b/examples/complete-dns-validation-with-cloudflare/versions.tf index 3177d7c..3f6455b 100644 --- a/examples/complete-dns-validation-with-cloudflare/versions.tf +++ b/examples/complete-dns-validation-with-cloudflare/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.10" required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.40" + version = ">= 6.0" } # Terraform v1.0.0 only functional with cloudflare versions less than or equal to 3.33.0 # https://github.com/cloudflare/terraform-provider-cloudflare/issues/2340 diff --git a/examples/complete-dns-validation/README.md b/examples/complete-dns-validation/README.md index 7d50798..5c33103 100644 --- a/examples/complete-dns-validation/README.md +++ b/examples/complete-dns-validation/README.md @@ -23,14 +23,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.40 | +| [terraform](#requirement\_terraform) | >= 1.10 | +| [aws](#requirement\_aws) | >= 6.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.40 | +| [aws](#provider\_aws) | >= 6.0 | ## Modules diff --git a/examples/complete-dns-validation/versions.tf b/examples/complete-dns-validation/versions.tf index fa875db..f648e20 100644 --- a/examples/complete-dns-validation/versions.tf +++ b/examples/complete-dns-validation/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.10" required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.40" + version = ">= 6.0" } } } diff --git a/examples/complete-email-validation-with-validation-domain/README.md b/examples/complete-email-validation-with-validation-domain/README.md index 18721d4..92a6571 100644 --- a/examples/complete-email-validation-with-validation-domain/README.md +++ b/examples/complete-email-validation-with-validation-domain/README.md @@ -32,14 +32,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.40 | +| [terraform](#requirement\_terraform) | >= 1.10 | +| [aws](#requirement\_aws) | >= 6.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.40 | +| [aws](#provider\_aws) | >= 6.0 | ## Modules diff --git a/examples/complete-email-validation-with-validation-domain/versions.tf b/examples/complete-email-validation-with-validation-domain/versions.tf index fa875db..f648e20 100644 --- a/examples/complete-email-validation-with-validation-domain/versions.tf +++ b/examples/complete-email-validation-with-validation-domain/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.10" required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.40" + version = ">= 6.0" } } } diff --git a/examples/complete-email-validation/README.md b/examples/complete-email-validation/README.md index 1371217..60348af 100644 --- a/examples/complete-email-validation/README.md +++ b/examples/complete-email-validation/README.md @@ -36,14 +36,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.40 | +| [terraform](#requirement\_terraform) | >= 1.10 | +| [aws](#requirement\_aws) | >= 6.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.40 | +| [aws](#provider\_aws) | >= 6.0 | ## Modules diff --git a/examples/complete-email-validation/versions.tf b/examples/complete-email-validation/versions.tf index fa875db..f648e20 100644 --- a/examples/complete-email-validation/versions.tf +++ b/examples/complete-email-validation/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.10" required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.40" + version = ">= 6.0" } } } diff --git a/versions.tf b/versions.tf index 312f346..f648e20 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.10.0" + required_version = ">= 1.10" required_providers { aws = { diff --git a/wrappers/versions.tf b/wrappers/versions.tf index 312f346..f648e20 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 1.10.0" + required_version = ">= 1.10" required_providers { aws = {