From c9ef4656ac2cddbbcd203c7f4a42d06345edd59a Mon Sep 17 00:00:00 2001 From: badra001 Date: Tue, 28 Mar 2023 19:57:27 -0400 Subject: [PATCH] add region --- route53-zone-association/vpc/README.md | 1 + route53-zone-association/vpc/main.tf | 4 ++-- route53-zone-association/vpc/variables.tf | 6 ++++++ route53-zone-association/zone/README.md | 1 + route53-zone-association/zone/main.tf | 4 ++-- route53-zone-association/zone/variables.tf | 6 ++++++ 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/route53-zone-association/vpc/README.md b/route53-zone-association/vpc/README.md index 3303b7e..fa5e28b 100644 --- a/route53-zone-association/vpc/README.md +++ b/route53-zone-association/vpc/README.md @@ -56,6 +56,7 @@ No modules. | [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no | | [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | | [private\_zone](#input\_private\_zone) | Selection either private or public (default: private) for named zones | `bool` | `true` | no | +| [region](#input\_region) | AWS Region to select for peer (default: from provider aws.peer) | `string` | `null` | no | | [tags](#input\_tags) | AWS Tags to apply to appropriate resources (S3, KMS). Do not include safeguard tags here, use the data\_safeguard field for such things. | `map(string)` | `{}` | no | | [vpc\_id](#input\_vpc\_id) | VPC ID with which to associate Route53 PHZs | `string` | n/a | yes | | [zone\_ids](#input\_zone\_ids) | List of Route53 PHZ IDs to associate with a (local/remote) VPC | `list(string)` | `[]` | no | diff --git a/route53-zone-association/vpc/main.tf b/route53-zone-association/vpc/main.tf index 435acfd..f2e13b8 100644 --- a/route53-zone-association/vpc/main.tf +++ b/route53-zone-association/vpc/main.tf @@ -24,7 +24,7 @@ resource "aws_route53_vpc_association_authorization" "peer_zone" { provider = aws.peer for_each = data.aws_caller_identity.self.account_id != data.aws_caller_identity.peer.account_id ? toset(var.zone_ids) : toset([]) zone_id = each.key - vpc_region = data.aws_region.peer.name + vpc_region = var.region == null ? data.aws_region.peer.name : var.region vpc_id = var.vpc_id } @@ -56,7 +56,7 @@ resource "aws_route53_vpc_association_authorization" "peer_zones" { provider = aws.peer for_each = data.aws_caller_identity.self.account_id != data.aws_caller_identity.peer.account_id ? toset(local.zones_ids) : toset([]) zone_id = each.key - vpc_region = data.aws_region.peer.name + vpc_region = var.region == null ? data.aws_region.peer.name : var.region vpc_id = var.vpc_id } diff --git a/route53-zone-association/vpc/variables.tf b/route53-zone-association/vpc/variables.tf index 8f1dde3..f94866f 100644 --- a/route53-zone-association/vpc/variables.tf +++ b/route53-zone-association/vpc/variables.tf @@ -20,3 +20,9 @@ variable "private_zone" { type = bool default = true } + +variable "region" { + description = "AWS Region to select for peer (default: from provider aws.peer)" + type = string + default = null +} diff --git a/route53-zone-association/zone/README.md b/route53-zone-association/zone/README.md index 3663737..ecdfb91 100644 --- a/route53-zone-association/zone/README.md +++ b/route53-zone-association/zone/README.md @@ -52,6 +52,7 @@ No modules. | [account\_alias](#input\_account\_alias) | AWS Account Alias (default: will pull from current account\_alias) | `string` | `""` | no | | [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no | | [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | +| [region](#input\_region) | AWS Region to select for peer (default: from provider aws.peer) | `string` | `null` | no | | [tags](#input\_tags) | AWS Tags to apply to appropriate resources (S3, KMS). Do not include safeguard tags here, use the data\_safeguard field for such things. | `map(string)` | `{}` | no | | [vpc\_id](#input\_vpc\_id) | VPC ID with which to associate Route53 PHZs | `string` | n/a | yes | | [zone\_ids](#input\_zone\_ids) | List of Route53 PHZ IDs to associate with a (local/remote) VPC | `list(string)` | `[]` | no | diff --git a/route53-zone-association/zone/main.tf b/route53-zone-association/zone/main.tf index 0cf3c6c..7c1066b 100644 --- a/route53-zone-association/zone/main.tf +++ b/route53-zone-association/zone/main.tf @@ -21,7 +21,7 @@ resource "aws_route53_vpc_association_authorization" "self_zone" { provider = aws.self for_each = data.aws_caller_identity.self.account_id != data.aws_caller_identity.peer.account_id ? toset(var.zone_ids) : toset([]) zone_id = each.key - vpc_region = data.aws_region.peer.name + vpc_region = var.region == null ? data.aws_region.peer.name : var.region vpc_id = var.vpc_id } @@ -31,7 +31,7 @@ resource "aws_route53_zone_association" "self_zone" { zone_id = each.key vpc_id = var.vpc_id - vpc_region = data.aws_region.peer.name + vpc_region = var.region == null ? data.aws_region.peer.name : var.region depends_on = [aws_route53_vpc_association_authorization.self_zone] } diff --git a/route53-zone-association/zone/variables.tf b/route53-zone-association/zone/variables.tf index 5379683..467b628 100644 --- a/route53-zone-association/zone/variables.tf +++ b/route53-zone-association/zone/variables.tf @@ -8,3 +8,9 @@ variable "vpc_id" { description = "VPC ID with which to associate Route53 PHZs" type = string } + +variable "region" { + description = "AWS Region to select for peer (default: from provider aws.peer)" + type = string + default = null +}