From 461eef2a24eac18a513a3f7f6c5993c61cd8c73a Mon Sep 17 00:00:00 2001 From: Bohdan Hutkovskyy <34111988+bhutkovskyysos@users.noreply.github.com> Date: Sat, 8 Jun 2024 14:50:02 -0400 Subject: [PATCH] feat!: Add support for geoproximity routing policy. Upgraded TF version to 1.3.2 (#105) Co-authored-by: Anton Babenko --- .pre-commit-config.yaml | 4 ++-- README.md | 4 ++-- examples/complete/README.md | 6 ++--- examples/complete/main.tf | 24 +++++++++++++++++++ examples/complete/versions.tf | 4 ++-- modules/delegation-sets/README.md | 2 +- modules/delegation-sets/versions.tf | 2 +- modules/records/README.md | 6 ++--- modules/records/main.tf | 19 +++++++++++++++ modules/records/versions.tf | 4 ++-- modules/resolver-rule-associations/README.md | 2 +- .../resolver-rule-associations/versions.tf | 2 +- modules/zones/README.md | 2 +- modules/zones/versions.tf | 2 +- 14 files changed, 63 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 395404e..9edd7d3 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.88.0 + rev: v1.91.0 hooks: - id: terraform_fmt - id: terraform_docs @@ -24,7 +24,7 @@ repos: - '--args=--only=terraform_unused_required_providers' - id: terraform_validate - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-merge-conflict - id: end-of-file-fixer diff --git a/README.md b/README.md index a98bf60..4a3c2fc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ There are independent submodules: ```hcl module "zones" { source = "terraform-aws-modules/route53/aws//modules/zones" - version = "~> 2.0" + version = "~> 3.0" zones = { "terraform-aws-modules-example.com" = { @@ -40,7 +40,7 @@ module "zones" { module "records" { source = "terraform-aws-modules/route53/aws//modules/records" - version = "~> 2.0" + version = "~> 3.0" zone_name = keys(module.zones.route53_zone_zone_id)[0] diff --git a/examples/complete/README.md b/examples/complete/README.md index 7ec9617..c313b04 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -21,14 +21,14 @@ Note that this example may create resources which cost money. Run `terraform des | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 2.49 | +| [terraform](#requirement\_terraform) | >= 1.3.2 | +| [aws](#requirement\_aws) | >= 5.37 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 2.49 | +| [aws](#provider\_aws) | >= 5.37 | ## Modules diff --git a/examples/complete/main.tf b/examples/complete/main.tf index f5b2fe5..edc3890 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -83,6 +83,30 @@ module "records" { continent = "EU" } }, + { + name = "geoproximity-aws-region" + type = "CNAME" + ttl = 5 + records = ["us-east-1.test.example.com."] + set_identifier = "us-east-1-region" + geoproximity_routing_policy = { + aws_region = "us-east-1" + bias = 0 + } + }, + { + name = "geoproximity-coordinates" + type = "CNAME" + ttl = 5 + records = ["nyc.test.example.com."] + set_identifier = "nyc" + geoproximity_routing_policy = { + coordinates = { + latitude = "40.71" + longitude = "-74.01" + } + } + }, { name = "cloudfront" type = "A" diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index b16162b..a087d39 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 1.0" + required_version = ">= 1.3.2" required_providers { aws = { source = "hashicorp/aws" - version = ">= 2.49" + version = ">= 5.37" } } } diff --git a/modules/delegation-sets/README.md b/modules/delegation-sets/README.md index 826a491..8aeae3b 100644 --- a/modules/delegation-sets/README.md +++ b/modules/delegation-sets/README.md @@ -47,7 +47,7 @@ module "zones" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.3.2 | | [aws](#requirement\_aws) | >= 3.56 | ## Providers diff --git a/modules/delegation-sets/versions.tf b/modules/delegation-sets/versions.tf index 9480a77..c24bafd 100644 --- a/modules/delegation-sets/versions.tf +++ b/modules/delegation-sets/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.3.2" required_providers { aws = { diff --git a/modules/records/README.md b/modules/records/README.md index b8f3169..2e1a6a2 100644 --- a/modules/records/README.md +++ b/modules/records/README.md @@ -31,14 +31,14 @@ records_jsonencoded = jsonencode([ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | -| [aws](#requirement\_aws) | >= 2.49 | +| [terraform](#requirement\_terraform) | >= 1.3.2 | +| [aws](#requirement\_aws) | >= 5.37 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 2.49 | +| [aws](#provider\_aws) | >= 5.37 | ## Modules diff --git a/modules/records/main.tf b/modules/records/main.tf index 0e20451..5c89123 100644 --- a/modules/records/main.tf +++ b/modules/records/main.tf @@ -72,4 +72,23 @@ resource "aws_route53_record" "this" { subdivision = lookup(each.value.geolocation_routing_policy, "subdivision", null) } } + + dynamic "geoproximity_routing_policy" { + for_each = length(keys(lookup(each.value, "geoproximity_routing_policy", {}))) == 0 ? [] : [true] + + content { + aws_region = lookup(each.value.geoproximity_routing_policy, "aws_region", null) + bias = lookup(each.value.geoproximity_routing_policy, "bias", null) + local_zone_group = lookup(each.value.geoproximity_routing_policy, "local_zone_group", null) + + dynamic "coordinates" { + for_each = lookup(each.value.geoproximity_routing_policy, "coordinates", null) == null ? [] : [lookup(each.value.geoproximity_routing_policy, "coordinates", null)] + + content { + latitude = coordinates.value.latitude + longitude = coordinates.value.longitude + } + } + } + } } diff --git a/modules/records/versions.tf b/modules/records/versions.tf index 6c3afcb..a087d39 100644 --- a/modules/records/versions.tf +++ b/modules/records/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.3.2" required_providers { aws = { source = "hashicorp/aws" - version = ">= 2.49" + version = ">= 5.37" } } } diff --git a/modules/resolver-rule-associations/README.md b/modules/resolver-rule-associations/README.md index 189df84..0f0ff9b 100644 --- a/modules/resolver-rule-associations/README.md +++ b/modules/resolver-rule-associations/README.md @@ -31,7 +31,7 @@ module "resolver_rule_associations" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.3.2 | | [aws](#requirement\_aws) | >= 3.56 | ## Providers diff --git a/modules/resolver-rule-associations/versions.tf b/modules/resolver-rule-associations/versions.tf index 9480a77..c24bafd 100644 --- a/modules/resolver-rule-associations/versions.tf +++ b/modules/resolver-rule-associations/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.3.2" required_providers { aws = { diff --git a/modules/zones/README.md b/modules/zones/README.md index 3503869..4101465 100644 --- a/modules/zones/README.md +++ b/modules/zones/README.md @@ -7,7 +7,7 @@ This module creates Route53 zones. | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.3.2 | | [aws](#requirement\_aws) | >= 2.49 | ## Providers diff --git a/modules/zones/versions.tf b/modules/zones/versions.tf index 6c3afcb..cb4f2fe 100644 --- a/modules/zones/versions.tf +++ b/modules/zones/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.3.2" required_providers { aws = {