From 68acbe2842a1e45561b51cb533912cf7c551b98d Mon Sep 17 00:00:00 2001 From: shockrah Date: Sun, 8 Dec 2024 13:40:31 -0800 Subject: [PATCH] Updating the dns with a new test entry --- infra/dns/Makefile | 24 ---------------- infra/dns/build.sh | 34 +++++++++++++++++++++++ infra/dns/project-athens-xyz.tf | 49 --------------------------------- infra/dns/shockrah-xyz.tf | 6 ++-- 4 files changed, 38 insertions(+), 75 deletions(-) delete mode 100644 infra/dns/Makefile create mode 100644 infra/dns/build.sh delete mode 100644 infra/dns/project-athens-xyz.tf diff --git a/infra/dns/Makefile b/infra/dns/Makefile deleted file mode 100644 index cb42529..0000000 --- a/infra/dns/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -plan=out.plan - -SHELL := /bin/bash - -$(plan): *.tf - source ../secrets/set-env.sh && terraform plan -input=false -out $(plan) - -push: build - source ../secrets/set-env.sh && terraform apply $(plan) - -refresh: - source ../secrets/set-env.sh && terraform apply -refresh-only - -test: - terraform validate - - -rip: - source ../secrets/set-env.sh && terraform destroy - -clean: - rm -f $(plan) - -.PHONY: test build clean push rip diff --git a/infra/dns/build.sh b/infra/dns/build.sh new file mode 100644 index 0000000..62765b2 --- /dev/null +++ b/infra/dns/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +opt=$1 +plan=tfplan + +build_plan() { + echo Generating plan + set -x + terraform plan -var-file variables.tfvars -input=false -out $plan +} + +deploy_plan() { + terraform apply $plan +} + +init() { + terraform init +} + +help_prompt() { + cat <<- EOF + Options: plan deploy help + EOF +} + +# Default to building a plan +source ./secrets.sh +case $opt in + plan) build_plan;; + deploy) deploy_plan;; + *) help_prompt;; +esac \ No newline at end of file diff --git a/infra/dns/project-athens-xyz.tf b/infra/dns/project-athens-xyz.tf deleted file mode 100644 index f831f9d..0000000 --- a/infra/dns/project-athens-xyz.tf +++ /dev/null @@ -1,49 +0,0 @@ -############################# -# project-athens.xyz DNS ZONE -############################# - -# This entry is just for the sample service that is just plain nginx -# No TLS will be placed on this just yet as we need to make sure this -# and the load balancer are setup to receive things properly -resource "aws_route53_zone" "project-athens" { - name = "project-athens.xyz" - comment = "Project Athens domain zone" -} - - -locals { - project-athens-records = [ - { - name = "project-athens.xyz" - type = "NS" - ttl = 172800 - records = [ - "ns-806.awsdns-36.net.", - "ns-1881.awsdns-43.co.uk.", - "ns-1109.awsdns-10.org.", - "ns-11.awsdns-01.com.", - ] - }, - { - name = "project-athens.xyz" - type = "SOA" - ttl = 900 - records = [ - "ns-806.awsdns-36.net. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400" - ] - } - ] -} - -resource "aws_route53_record" "project-athens-record" { - for_each = { - for index, record in local.project-athens-records: - index => record - } - zone_id = aws_route53_zone.project-athens.id - name = each.value.name - type = lookup(each.value, "type", "A") - ttl = lookup(each.value, "ttl", 300) - records = each.value.records -} - diff --git a/infra/dns/shockrah-xyz.tf b/infra/dns/shockrah-xyz.tf index 7e9c03b..a6c6f22 100644 --- a/infra/dns/shockrah-xyz.tf +++ b/infra/dns/shockrah-xyz.tf @@ -36,8 +36,10 @@ locals { }, { name = "www.shockrah.xyz", records = [ var.vultr_host ] }, { name = "resume.shockrah.xyz", records = [ var.vultr_host ] }, - { name = "immich.shockrah.xyz", records = [ "45.32.92.196" ] }, - { name = "git.shockrah.xyz", records = [ var.vultr_host ] }, + { name = "immich.shockrah.xyz", records = [ "45.32.92.196" ] }, + { name = "git.shockrah.xyz", records = [ var.vultr_host ] }, + # This entry will be for a mega simple website that we're gonna try and host for the lulz + { name = "test.shockrah.xyz", records = [ "45.77.123.107" ] } ] }