diff --git a/route53-zone-association/zone/README.md b/route53-zone-association/zone/README.md index ecdfb91..74b0a86 100644 --- a/route53-zone-association/zone/README.md +++ b/route53-zone-association/zone/README.md @@ -44,6 +44,7 @@ No modules. | [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | | [aws_region.peer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | | [aws_region.self](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source | +| [aws_route53_zone.zones](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | ## Inputs @@ -59,4 +60,6 @@ No modules. ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [zones](#output\_zones) | Map of zone ids to zone names for PHZs | diff --git a/route53-zone-association/zone/main.tf b/route53-zone-association/zone/main.tf index 7c1066b..08c3e30 100644 --- a/route53-zone-association/zone/main.tf +++ b/route53-zone-association/zone/main.tf @@ -35,3 +35,18 @@ resource "aws_route53_zone_association" "self_zone" { depends_on = [aws_route53_vpc_association_authorization.self_zone] } + +#--- +# zone list +#--- +data "aws_route53_zone" "zones" { + provider = aws.self + for_each = toset(var.zones) + zone_id = each.key + private_zone = var.private_zone +} + +output "zones" { + description = "Map of zone ids to zone names for PHZs" + value = { for k, v in data.aws_route53_zone.zones : k => v.name } +}