generated from dxw/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally create Route53 Hosted Zone
* This allows creating Route53 Hosted Zones, with delegation (NS) records created in anoter (root) Route53 zone. * To create the delegation records, an AWS profile name must be provided, and the current user must have access to read/write to that Route53 zone * The Infrastructure Route53 zone will be used to hold DNS records for the resources launched.
- Loading branch information
Showing
6 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
data "aws_caller_identity" "current" {} | ||
|
||
data "aws_route53_zone" "root" { | ||
count = local.create_infrastructure_route53_delegations ? 1 : 0 | ||
|
||
name = local.route53_root_hosted_zone_domain_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
resource "aws_route53_zone" "infrastructure" { | ||
count = local.enable_infrastructure_route53_hosted_zone ? 1 : 0 | ||
|
||
name = local.infrastructure_route53_domain | ||
} | ||
|
||
resource "aws_route53_record" "infrastructure_ns" { | ||
count = local.create_infrastructure_route53_delegations ? 1 : 0 | ||
|
||
provider = aws.awsroute53root | ||
|
||
name = local.infrastructure_route53_domain | ||
ttl = 172800 | ||
type = "NS" | ||
zone_id = data.aws_route53_zone.root[0].zone_id | ||
|
||
records = [ | ||
aws_route53_zone.infrastructure[0].name_servers[0], | ||
aws_route53_zone.infrastructure[0].name_servers[1], | ||
aws_route53_zone.infrastructure[0].name_servers[2], | ||
aws_route53_zone.infrastructure[0].name_servers[3], | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters