Skip to content

Commit

Permalink
add region
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Mar 28, 2023
1 parent 19d7f43 commit c9ef465
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions route53-zone-association/vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ No modules.
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no |
| <a name="input_override_prefixes"></a> [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no |
| <a name="input_private_zone"></a> [private\_zone](#input\_private\_zone) | Selection either private or public (default: private) for named zones | `bool` | `true` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS Region to select for peer (default: from provider aws.peer) | `string` | `null` | no |
| <a name="input_tags"></a> [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 |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID with which to associate Route53 PHZs | `string` | n/a | yes |
| <a name="input_zone_ids"></a> [zone\_ids](#input\_zone\_ids) | List of Route53 PHZ IDs to associate with a (local/remote) VPC | `list(string)` | `[]` | no |
Expand Down
4 changes: 2 additions & 2 deletions route53-zone-association/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
6 changes: 6 additions & 0 deletions route53-zone-association/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions route53-zone-association/zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ No modules.
| <a name="input_account_alias"></a> [account\_alias](#input\_account\_alias) | AWS Account Alias (default: will pull from current account\_alias) | `string` | `""` | no |
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account ID (default: will pull from current user) | `string` | `""` | no |
| <a name="input_override_prefixes"></a> [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component. This should be used primarily for common infrastructure things | `map(string)` | `{}` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS Region to select for peer (default: from provider aws.peer) | `string` | `null` | no |
| <a name="input_tags"></a> [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 |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID with which to associate Route53 PHZs | `string` | n/a | yes |
| <a name="input_zone_ids"></a> [zone\_ids](#input\_zone\_ids) | List of Route53 PHZ IDs to associate with a (local/remote) VPC | `list(string)` | `[]` | no |
Expand Down
4 changes: 2 additions & 2 deletions route53-zone-association/zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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]
}
6 changes: 6 additions & 0 deletions route53-zone-association/zone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c9ef465

Please sign in to comment.