Skip to content

Commit

Permalink
add zone list
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jul 30, 2024
1 parent d8f800f commit c0954d1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions dns_zones.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ locals {
zone_ids = compact(var.zone_ids)
}

#-------------------------------------------------
# Providers for Cross Account DNS Action
#-------------------------------------------------
provider "aws" {
alias = "self"
assume_role {
role_arn = format("arn:%v:iam::%v:role/r-inf-terraform", data.aws_arn.current.partition, var.account_id)
session_name = var.os_username
}
}

#---
# network prod
#---
Expand All @@ -42,6 +31,7 @@ provider "aws" {
# dummy vpc, so we can associate the zone to this account
#---
data "aws_vpc" "dummy_vpc" {
provider = aws
depends_on = [aws_vpc.vpc]
count = !(var.shared_vpc_label == null || var.shared_vpc_label == "") ? 1 : 0
filter {
Expand All @@ -56,6 +46,7 @@ data "aws_vpc" "dummy_vpc" {

## Dummy VPC
resource "aws_vpc" "vpc" {
provider = aws
cidr_block = "192.168.0.0/24"
enable_dns_support = false
enable_dns_hostnames = false
Expand All @@ -65,8 +56,18 @@ resource "aws_vpc" "vpc" {
)
}

#---
# zone list
#---
data "aws_route53_zone" "zones" {
provider = aws.self
for_each = toset(local.zone_ids)
zone_id = each.key
private_zone = true
}

resource "aws_route53_zone" "cluster_domain" {
provider = aws
name = local.cluster_domain_name
comment = local.cluster_domain_description
force_destroy = false
Expand Down

0 comments on commit c0954d1

Please sign in to comment.