Add working base record set
- Mail - Spaces Bucket - CDN - Nameserver
This commit is contained in:
parent
66bf6fbaaa
commit
55df7fa5c2
|
@ -34,49 +34,58 @@ resource "digitalocean_spaces_bucket" "distrust_co" {
|
|||
acl = "public-read"
|
||||
}
|
||||
|
||||
## Handle record for CDN redirect
|
||||
resource "digitalocean_record" "cdn" {
|
||||
domain = "distrust.co"
|
||||
type = "CNAME"
|
||||
name = "${digitalocean_cdn.distrust_co.origin}."
|
||||
value = "distrust.co"
|
||||
}
|
||||
|
||||
## Create a DigitalOcean managed Let's Encrypt Certificate
|
||||
resource "digitalocean_certificate" "cert" {
|
||||
name = "cdn-cert"
|
||||
type = "lets_encrypt"
|
||||
domains = ["static.distrust.co"]
|
||||
}
|
||||
|
||||
# Add a CDN endpoint to the Spaces Bucket
|
||||
resource "digitalocean_cdn" "distrust_co" {
|
||||
origin = digitalocean_spaces_bucket.distrust_co.bucket_domain_name
|
||||
certificate_name = digitalocean_certificate.cert.name
|
||||
custom_domain = "static.distrust.co"
|
||||
# certificate_name = digitalocean_certificate.cert.name
|
||||
# custom_domain = "static.distrust.co"
|
||||
depends_on = [
|
||||
digitalocean_spaces_bucket.distrust_co
|
||||
]
|
||||
}
|
||||
|
||||
## Handle record for CDN redirect
|
||||
resource "digitalocean_record" "cdn" {
|
||||
domain = digitalocean_domain.default.name
|
||||
type = "CNAME"
|
||||
name = digitalocean_cdn.distrust_co.origin
|
||||
value = "${digitalocean_domain.default.name}."
|
||||
depends_on = [
|
||||
digitalocean_cdn.distrust_co
|
||||
]
|
||||
}
|
||||
|
||||
# ## Create a DigitalOcean managed Let's Encrypt Certificate
|
||||
# resource "digitalocean_certificate" "cert" {
|
||||
# name = "cdn-cert"
|
||||
# type = "lets_encrypt"
|
||||
# domains = ["static.distrust.co"]
|
||||
# }
|
||||
|
||||
# Output the endpoint for the CDN resource
|
||||
output "fqdn" {
|
||||
value = digitalocean_cdn.distrust_co.endpoint
|
||||
}
|
||||
#
|
||||
#
|
||||
output "cdn_origin" {
|
||||
value = digitalocean_cdn.distrust_co.origin
|
||||
}
|
||||
|
||||
# Handle record for distrust.co
|
||||
resource "digitalocean_record" "distrust_co" {
|
||||
domain = "distrust.co"
|
||||
type = "CNAME"
|
||||
name = "@"
|
||||
value = digitalocean_cdn.distrust_co.origin
|
||||
}
|
||||
# # Handle record for distrust.co
|
||||
# resource "digitalocean_record" "distrust_co-cdn" {
|
||||
# domain = digitalocean_domain.default.name
|
||||
# type = "CNAME"
|
||||
# name = "@"
|
||||
# value = "${digitalocean_cdn.distrust_co.origin}."
|
||||
# depends_on = [
|
||||
# digitalocean_cdn.distrust_co
|
||||
# ]
|
||||
# }
|
||||
|
||||
resource "digitalocean_record" "CNAME-www" {
|
||||
domain = digitalocean_domain.default.name
|
||||
type = "CNAME"
|
||||
name = "www"
|
||||
name = "www-main"
|
||||
value = "@"
|
||||
}
|
||||
|
||||
|
@ -200,7 +209,7 @@ resource "digitalocean_record" "mail-discovery" {
|
|||
resource "digitalocean_record" "mail-src-autodiscover" {
|
||||
domain = digitalocean_domain.default.id
|
||||
type = "SRV"
|
||||
name = "_autodiscover"
|
||||
name = "_autodiscover._tcp"
|
||||
port = 443
|
||||
priority = 0
|
||||
weight = 1
|
||||
|
@ -210,7 +219,7 @@ resource "digitalocean_record" "mail-src-autodiscover" {
|
|||
resource "digitalocean_record" "mail-srv-submissions" {
|
||||
domain = digitalocean_domain.default.id
|
||||
type = "SRV"
|
||||
name = "_submissions"
|
||||
name = "_submissions._tcp"
|
||||
port = 465
|
||||
priority = 0
|
||||
weight = 1
|
||||
|
@ -220,7 +229,7 @@ resource "digitalocean_record" "mail-srv-submissions" {
|
|||
resource "digitalocean_record" "mail-srv-imaps" {
|
||||
domain = digitalocean_domain.default.id
|
||||
type = "SRV"
|
||||
name = "_imaps"
|
||||
name = "_imaps._tcp"
|
||||
port = 993
|
||||
priority = 0
|
||||
weight = 1
|
||||
|
@ -230,7 +239,7 @@ resource "digitalocean_record" "mail-srv-imaps" {
|
|||
resource "digitalocean_record" "mail-srv-pop3s" {
|
||||
domain = digitalocean_domain.default.id
|
||||
type = "SRV"
|
||||
name = "_pop3s"
|
||||
name = "_pop3s._tcp"
|
||||
port = 995
|
||||
priority = 0
|
||||
weight = 1
|
||||
|
|
Loading…
Reference in New Issue