Skip to content

Commit

Permalink
add output
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Apr 3, 2023
1 parent 5e37d7d commit 4f45225
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion route53-zone-association/zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -59,4 +60,6 @@ No modules.

## Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_zones"></a> [zones](#output\_zones) | Map of zone ids to zone names for PHZs |
15 changes: 15 additions & 0 deletions route53-zone-association/zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

0 comments on commit 4f45225

Please sign in to comment.