8000 create int.${domain} internal zone in R53 and added both db instances by dominis · Pull Request #1 · dominis/mikado · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions terraform/wp/r53.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
resource "aws_route53_zone" "domain" {
name = "${var.domain}"

tags {
Mikado = "True"
}
}

resource "aws_route53_record" "apex" {
Expand Down Expand Up @@ -48,6 +52,59 @@ resource "aws_route53_record" "test" {
}
}

##############
# Internal DNS
##############
resource "aws_route53_zone" "int" {
name = "int.${var.domain}"
vpc_id = "${var.vpc_id}"

tags {
Mikado = "True"
}
}

resource "aws_route53_record" "int-ns" {
zone_id = "${aws_route53_zone.domain.zone_id}"
name = "int.${var.domain}"
type = "NS"
ttl = "30"

records = [
"${aws_route53_zone.int.name_servers.0}",
"${aws_route53_zone.int.name_servers.1}",
"${aws_route53_zone.int.name_servers.2}",
"${aws_route53_zone.int.name_servers.3}",
]
}

resource "aws_route53_record" "rds" {
zone_id = "${aws_route53_zone.int.zone_id}"
name = "prod.db.int.${var.domain}"
type = "A"

alias {
name = "${aws_db_instance.wp-prod.address}"
zone_id = "${aws_db_instance.wp-prod.hosted_zone_id}"
evaluate_target_health = true
}
}

resource "aws_route53_record" "test-rds" {
zone_id = "${aws_route53_zone.int.zone_id}"
name = "test.db.int.${var.domain}"
type = "A"

alias {
name = "${aws_db_instance.wp-test.address}"
zone_id = "${aws_db_instance.wp-test.hosted_zone_id}"
evaluate_target_health = true
}
}

##########
# Outputs
##########
output "nameservers" {
value = "${join(", ", aws_route53_zone.domain.name_servers)}"
}
Expand Down
0