2017-01-31 22:12:46 +00:00
|
|
|
#Terraform and its management of DNS in route53
|
|
|
|
|
|
|
|
#Setup the domain in route53
|
|
|
|
resource "aws_route53_zone" "ahosking" {
|
2021-10-13 14:58:41 +00:00
|
|
|
name = "ahosking.com"
|
2017-01-31 22:12:46 +00:00
|
|
|
}
|
|
|
|
|
2021-01-12 03:46:49 +00:00
|
|
|
resource "cloudflare_zone" "ahosking_com" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone = "ahosking.com"
|
|
|
|
plan = "free"
|
2021-01-12 03:46:49 +00:00
|
|
|
}
|
|
|
|
|
2021-01-12 04:11:44 +00:00
|
|
|
resource "cloudflare_record" "ahosking" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = "ahosking.com"
|
|
|
|
type = "A"
|
|
|
|
ttl = "1"
|
|
|
|
value = var.site5_ip
|
2017-01-31 22:12:46 +00:00
|
|
|
}
|
|
|
|
|
2021-01-12 04:11:44 +00:00
|
|
|
resource "cloudflare_record" "ahosking_wildcard" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = "*.ahosking.com"
|
|
|
|
type = "A"
|
|
|
|
ttl = "1"
|
|
|
|
value = var.home_ip
|
2017-01-31 22:12:46 +00:00
|
|
|
}
|
|
|
|
|
2021-01-12 04:11:44 +00:00
|
|
|
resource "cloudflare_record" "ahosking_www" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = "www.ahosking.com"
|
|
|
|
type = "CNAME"
|
|
|
|
ttl = "1"
|
|
|
|
value = cloudflare_record.ahosking.name
|
|
|
|
proxied = "true"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "cloudflare_record" "ahosking_home" {
|
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = "home"
|
|
|
|
type = "A"
|
|
|
|
ttl = "1"
|
|
|
|
value = var.home_ip
|
|
|
|
}
|
|
|
|
|
2021-10-14 17:58:56 +00:00
|
|
|
resource "cloudflare_record" "ahosking_cnames" {
|
|
|
|
for_each = toset(var.ahosking_com_cnames)
|
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = each.key
|
|
|
|
type = "CNAME"
|
|
|
|
ttl = "1"
|
|
|
|
value = join(".", [cloudflare_record.ahosking_home.name, cloudflare_zone.ahosking_com.zone])
|
|
|
|
proxied = true
|
2017-01-31 22:12:46 +00:00
|
|
|
}
|
|
|
|
|
2021-01-12 04:11:44 +00:00
|
|
|
# email MX value for DNS
|
|
|
|
resource "cloudflare_record" "ahosking_mx" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = cloudflare_zone.ahosking_com.zone
|
|
|
|
type = "MX"
|
|
|
|
ttl = "60"
|
|
|
|
value = "aspmx.l.google.com"
|
|
|
|
priority = 1
|
2021-01-12 04:11:44 +00:00
|
|
|
}
|
|
|
|
resource "cloudflare_record" "ahosking_mx1" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = cloudflare_zone.ahosking_com.zone
|
|
|
|
type = "MX"
|
|
|
|
ttl = "60"
|
|
|
|
value = "alt1.aspmx.l.google.com"
|
|
|
|
priority = 5
|
2021-01-12 04:11:44 +00:00
|
|
|
}
|
|
|
|
resource "cloudflare_record" "ahosking_mx2" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = cloudflare_zone.ahosking_com.zone
|
|
|
|
type = "MX"
|
|
|
|
ttl = "60"
|
|
|
|
value = "alt2.aspmx.l.google.com"
|
|
|
|
priority = 5
|
2021-01-12 04:11:44 +00:00
|
|
|
}
|
|
|
|
resource "cloudflare_record" "ahosking_mx3" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = cloudflare_zone.ahosking_com.zone
|
|
|
|
type = "MX"
|
|
|
|
ttl = "60"
|
|
|
|
value = "alt3.aspmx.l.google.com"
|
|
|
|
priority = 10
|
2021-01-12 04:11:44 +00:00
|
|
|
}
|
|
|
|
resource "cloudflare_record" "ahosking_mx4" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = cloudflare_zone.ahosking_com.zone
|
|
|
|
type = "MX"
|
|
|
|
ttl = "60"
|
|
|
|
value = "alt4.aspmx.l.google.com"
|
|
|
|
priority = 10
|
2021-01-12 04:11:44 +00:00
|
|
|
}
|
|
|
|
resource "cloudflare_record" "ahosking_txt" {
|
2021-10-13 14:58:41 +00:00
|
|
|
zone_id = cloudflare_zone.ahosking_com.id
|
|
|
|
name = cloudflare_zone.ahosking_com.zone
|
|
|
|
type = "TXT"
|
|
|
|
ttl = 60
|
|
|
|
value = "google-site-verification=8-QKnBQElI58gnygDWcCzvDGRh31c_bFmNMaSd0fCwE"
|
2019-12-29 07:15:42 +00:00
|
|
|
}
|