From 20517cdc044161847674f87ac8ec89689b2ebb85 Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Sun, 2 Jan 2022 08:59:38 -0800 Subject: [PATCH] Add route53 subdomain --- nextcloud.tf | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/nextcloud.tf b/nextcloud.tf index a147a99..9f279b1 100644 --- a/nextcloud.tf +++ b/nextcloud.tf @@ -137,10 +137,45 @@ data "aws_iam_policy" "nextcloud" { arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM" } +## route53 + +module "zone" { + source = "terraform-aws-modules/route53/aws//modules/zones" + version = "~> 2.0" + + zones = { + "cloud.stoopid.club" = { + comment = "cloud.stoopid.club" + } + } +} + + +module "records" { + source = "terraform-aws-modules/route53/aws//modules/records" + version = "~> 2.0" + + zone_name = keys(module.zone.route53_zone_zone_id)[0] + + records = [ + { + name = "" + type = "A" + ttl = 600 # 10 minutes + records = [ aws_instance.nextcloud.public_ip ] + }, + ] + + depends_on = [module.zone] +} + output "instance_id" { value = aws_instance.nextcloud.id } output "public_ip" { value = aws_instance.nextcloud.public_ip } +output "nameservers" { + value = module.zone.route53_zone_name_servers +}