Move DNS records to gitea terraform

This commit is contained in:
jdormit 2024-02-12 11:31:41 -05:00
parent ca0bc6e5c8
commit cfde0a0e72
4 changed files with 60 additions and 41 deletions

View File

@ -34,44 +34,3 @@ resource "digitalocean_record" "keybase_verification" {
ttl = 3600 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
}

View File

@ -1,3 +1,7 @@
output "jeremydormitzer_com_urn" { output "jeremydormitzer_com_urn" {
value = digitalocean_domain.jeremydormitzer_com.urn value = digitalocean_domain.jeremydormitzer_com.urn
} }
output "jeremydormitzer_com_name" {
value = digitalocean_domain.jeremydormitzer_com.name
}

View File

@ -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"
}
}

View File

@ -30,3 +30,45 @@ resource "digitalocean_volume_attachment" "gitea" {
droplet_id = module.packer_droplet.droplet_id droplet_id = module.packer_droplet.droplet_id
volume_id = digitalocean_volume.gitea_volume.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
}