diff --git a/mgmt/do-jeremydormitzer-com/terraform/main.tf b/mgmt/do-jeremydormitzer-com/terraform/main.tf index c3bc88c..f4507da 100644 --- a/mgmt/do-jeremydormitzer-com/terraform/main.tf +++ b/mgmt/do-jeremydormitzer-com/terraform/main.tf @@ -34,44 +34,3 @@ resource "digitalocean_record" "keybase_verification" { ttl = 3600 } -resource "digitalocean_record" "git_mailgun_cname" { - domain = digitalocean_domain.jeremydormitzer_com.name - type = "CNAME" - name = "mail.mg.git" - value = "mailgun.org." - ttl = 3600 -} - -resource "digitalocean_record" "git" { - domain = digitalocean_domain.jeremydormitzer_com.name - type = "A" - name = "git" - value = data.terraform_remote_state.gitea.outputs.gitea_ip_address - ttl = 3600 -} - -resource "digitalocean_record" "git_mxa" { - domain = digitalocean_domain.jeremydormitzer_com.name - type = "MX" - name = "mg.git" - value = "mxa.mailgun.org." - priority = 10 - ttl = 3600 -} - -resource "digitalocean_record" "git_mxb" { - domain = digitalocean_domain.jeremydormitzer_com.name - type = "MX" - name = "mg.git" - value = "mxb.mailgun.org." - priority = 10 - ttl = 3600 -} - -resource "digitalocean_record" "git_txt" { - domain = digitalocean_domain.jeremydormitzer_com.name - type = "TXT" - name = "mx._domainkey.mg.git" - value = "\"k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpGHgB9oj3UdxdGUp9389PihevWCs+YKdkXv+C9DRv7nXY+L1bGjgqooIXwW9Bte5QC9lFpCN81NzK95gDYkX9rgo+huaeSw2B4slGBBWIBet4Wk6OafcQ2LsT9/VFUYeFyKD8AF4hV44CC5ZSWYVC6TiYCrNhEscQo9OYBhKicwIDAQAB\"" - ttl = 3600 -} diff --git a/mgmt/do-jeremydormitzer-com/terraform/outputs.tf b/mgmt/do-jeremydormitzer-com/terraform/outputs.tf index 51d6e6f..23b0794 100644 --- a/mgmt/do-jeremydormitzer-com/terraform/outputs.tf +++ b/mgmt/do-jeremydormitzer-com/terraform/outputs.tf @@ -1,3 +1,7 @@ output "jeremydormitzer_com_urn" { value = digitalocean_domain.jeremydormitzer_com.urn } + +output "jeremydormitzer_com_name" { + value = digitalocean_domain.jeremydormitzer_com.name +} diff --git a/prod/gitea/terraform/data.tf b/prod/gitea/terraform/data.tf new file mode 100644 index 0000000..b61fb8c --- /dev/null +++ b/prod/gitea/terraform/data.tf @@ -0,0 +1,14 @@ +data "terraform_remote_state" "do_jeremydormitzer_com" { + backend = "s3" + + config = { + skip_credentials_validation = true + skip_metadata_api_check = true + access_key = var.spaces_access_id + secret_key = var.spaces_secret_key + region = "us-east-1" + endpoint = "nyc3.digitaloceanspaces.com" + bucket = "jdormit-tf-state" + key = "mgmt/do-jeremydormitzer-com.tfstate" + } +} diff --git a/prod/gitea/terraform/main.tf b/prod/gitea/terraform/main.tf index 4efe8a3..ed1e3d8 100644 --- a/prod/gitea/terraform/main.tf +++ b/prod/gitea/terraform/main.tf @@ -30,3 +30,45 @@ resource "digitalocean_volume_attachment" "gitea" { droplet_id = module.packer_droplet.droplet_id volume_id = digitalocean_volume.gitea_volume.id } + +resource "digitalocean_record" "git_mailgun_cname" { + domain = data.terraform_remote_state.do_jeremydormitzer_com.outputs.jeremydormitzer_com_name + type = "CNAME" + name = "mail.mg.git" + value = "mailgun.org." + ttl = 3600 +} + +resource "digitalocean_record" "git" { + domain = data.terraform_remote_state.do_jeremydormitzer_com.outputs.jeremydormitzer_com_name + type = "A" + name = "git" + value = module.packer_droplet.droplet_ip_address + ttl = 3600 +} + +resource "digitalocean_record" "git_mxa" { + domain = data.terraform_remote_state.do_jeremydormitzer_com.outputs.jeremydormitzer_com_name + type = "MX" + name = "mg.git" + value = "mxa.mailgun.org." + priority = 10 + ttl = 3600 +} + +resource "digitalocean_record" "git_mxb" { + domain = data.terraform_remote_state.do_jeremydormitzer_com.outputs.jeremydormitzer_com_name + type = "MX" + name = "mg.git" + value = "mxb.mailgun.org." + priority = 10 + ttl = 3600 +} + +resource "digitalocean_record" "git_txt" { + domain = data.terraform_remote_state.do_jeremydormitzer_com.outputs.jeremydormitzer_com_name + type = "TXT" + name = "mx._domainkey.mg.git" + value = "\"k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCpGHgB9oj3UdxdGUp9389PihevWCs+YKdkXv+C9DRv7nXY+L1bGjgqooIXwW9Bte5QC9lFpCN81NzK95gDYkX9rgo+huaeSw2B4slGBBWIBet4Wk6OafcQ2LsT9/VFUYeFyKD8AF4hV44CC5ZSWYVC6TiYCrNhEscQo9OYBhKicwIDAQAB\"" + ttl = 3600 +}