Updating the dns with a new test entry
This commit is contained in:
		
							parent
							
								
									a6dc2da7be
								
							
						
					
					
						commit
						68acbe2842
					
				@ -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
 | 
					 | 
				
			||||||
							
								
								
									
										34
									
								
								infra/dns/build.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								infra/dns/build.sh
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
				
			||||||
@ -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
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -38,6 +38,8 @@ locals {
 | 
				
			|||||||
    { name = "resume.shockrah.xyz",   records = [ var.vultr_host ] },
 | 
					    { name = "resume.shockrah.xyz",   records = [ var.vultr_host ] },
 | 
				
			||||||
    { name = "immich.shockrah.xyz",   records = [ "45.32.92.196" ] },
 | 
					    { name = "immich.shockrah.xyz",   records = [ "45.32.92.196" ] },
 | 
				
			||||||
    { name = "git.shockrah.xyz",      records = [ var.vultr_host ] },
 | 
					    { 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" ] }
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user