From 367ea64e3e61628e362b6cdfb278f750d41f24ed Mon Sep 17 00:00:00 2001 From: Nick Adams Date: Wed, 21 Apr 2021 00:38:44 -0500 Subject: [PATCH] Changed file names, added name as output --- kms.tf => main.tf | 29 +++++++++++++++++++++++++++++ outputs.tf | 5 +++++ r53.tf | 25 ------------------------- 3 files changed, 34 insertions(+), 25 deletions(-) rename kms.tf => main.tf (58%) delete mode 100644 r53.tf diff --git a/kms.tf b/main.tf similarity index 58% rename from kms.tf rename to main.tf index 456767a..a8947cb 100644 --- a/kms.tf +++ b/main.tf @@ -1,3 +1,32 @@ +resource "aws_route53_zone" "this" { + name = var.domain_name +} + +resource "aws_route53_key_signing_key" "this" { + count = var.dnssec == true ? 1 : 0 + hosted_zone_id = aws_route53_zone.this.id + key_management_service_arn = aws_kms_key.this[0].arn + name = var.signing_key_name +} + +resource "aws_route53_hosted_zone_dnssec" "this" { + count = var.dnssec == true ? 1 : 0 + hosted_zone_id = aws_route53_key_signing_key.this[0].hosted_zone_id +} + +resource "aws_route53_record" "this" { + count = var.dnssec == true ? 1 : 0 + zone_id = aws_route53_zone.this.zone_id + name = "@.${aws_route53_zone.this.name}" + type = "DS" + ttl = var.ttl + + records = [aws_route53_key_signing_key.this[0].ds_record] +} + +####### +# KMS +####### resource "aws_kms_key" "this" { count = var.dnssec == true ? 1 : 0 description = "Used to sign dnssec records" diff --git a/outputs.tf b/outputs.tf index 17da860..6ec6969 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,6 +1,11 @@ output "zone_id" { value = aws_route53_zone.this.zone_id } + output "name_servers" { value = aws_route53_zone.this.name_servers +} + +output "name" { + value = aws_route53_zone.this.name } \ No newline at end of file diff --git a/r53.tf b/r53.tf deleted file mode 100644 index d470ed8..0000000 --- a/r53.tf +++ /dev/null @@ -1,25 +0,0 @@ -resource "aws_route53_zone" "this" { - name = var.domain_name -} - -resource "aws_route53_key_signing_key" "this" { - count = var.dnssec == true ? 1 : 0 - hosted_zone_id = aws_route53_zone.this.id - key_management_service_arn = aws_kms_key.this[0].arn - name = var.signing_key_name -} - -resource "aws_route53_hosted_zone_dnssec" "this" { - count = var.dnssec == true ? 1 : 0 - hosted_zone_id = aws_route53_key_signing_key.this[0].hosted_zone_id -} - -resource "aws_route53_record" "this" { - count = var.dnssec == true ? 1 : 0 - zone_id = aws_route53_zone.this.zone_id - name = "@.${aws_route53_zone.this.name}" - type = "DS" - ttl = var.ttl - - records = [aws_route53_key_signing_key.this[0].ds_record] -} \ No newline at end of file