forked from public/stack
Add working base record set
- Mail - Spaces Bucket - CDN - Nameserver
This commit is contained in:
parent
66bf6fbaaa
commit
55df7fa5c2
|
@ -34,50 +34,59 @@ resource "digitalocean_spaces_bucket" "distrust_co" {
|
||||||
acl = "public-read"
|
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
|
# Add a CDN endpoint to the Spaces Bucket
|
||||||
resource "digitalocean_cdn" "distrust_co" {
|
resource "digitalocean_cdn" "distrust_co" {
|
||||||
origin = digitalocean_spaces_bucket.distrust_co.bucket_domain_name
|
origin = digitalocean_spaces_bucket.distrust_co.bucket_domain_name
|
||||||
certificate_name = digitalocean_certificate.cert.name
|
# certificate_name = digitalocean_certificate.cert.name
|
||||||
custom_domain = "static.distrust.co"
|
# 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 the endpoint for the CDN resource
|
||||||
output "fqdn" {
|
output "fqdn" {
|
||||||
value = digitalocean_cdn.distrust_co.endpoint
|
value = digitalocean_cdn.distrust_co.endpoint
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
output "cdn_origin" {
|
output "cdn_origin" {
|
||||||
value = digitalocean_cdn.distrust_co.origin
|
value = digitalocean_cdn.distrust_co.origin
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle record for distrust.co
|
# # Handle record for distrust.co
|
||||||
resource "digitalocean_record" "distrust_co" {
|
# resource "digitalocean_record" "distrust_co-cdn" {
|
||||||
domain = "distrust.co"
|
# domain = digitalocean_domain.default.name
|
||||||
type = "CNAME"
|
# type = "CNAME"
|
||||||
name = "@"
|
# name = "@"
|
||||||
value = digitalocean_cdn.distrust_co.origin
|
# value = "${digitalocean_cdn.distrust_co.origin}."
|
||||||
}
|
# depends_on = [
|
||||||
|
# digitalocean_cdn.distrust_co
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
|
||||||
resource "digitalocean_record" "CNAME-www" {
|
resource "digitalocean_record" "CNAME-www" {
|
||||||
domain = digitalocean_domain.default.name
|
domain = digitalocean_domain.default.name
|
||||||
type = "CNAME"
|
type = "CNAME"
|
||||||
name = "www"
|
name = "www-main"
|
||||||
value = "@"
|
value = "@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# NameCheap Records
|
# NameCheap Records
|
||||||
|
@ -200,39 +209,39 @@ resource "digitalocean_record" "mail-discovery" {
|
||||||
resource "digitalocean_record" "mail-src-autodiscover" {
|
resource "digitalocean_record" "mail-src-autodiscover" {
|
||||||
domain = digitalocean_domain.default.id
|
domain = digitalocean_domain.default.id
|
||||||
type = "SRV"
|
type = "SRV"
|
||||||
name = "_autodiscover"
|
name = "_autodiscover._tcp"
|
||||||
port = 443
|
port = 443
|
||||||
priority = 0
|
priority = 0
|
||||||
weight = 1
|
weight = 1
|
||||||
value = "smtp.migadu.com"
|
value = "smtp.migadu.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "digitalocean_record" "mail-srv-submissions" {
|
resource "digitalocean_record" "mail-srv-submissions" {
|
||||||
domain = digitalocean_domain.default.id
|
domain = digitalocean_domain.default.id
|
||||||
type = "SRV"
|
type = "SRV"
|
||||||
name = "_submissions"
|
name = "_submissions._tcp"
|
||||||
port = 465
|
port = 465
|
||||||
priority = 0
|
priority = 0
|
||||||
weight = 1
|
weight = 1
|
||||||
value = "smtp.migadu.com"
|
value = "smtp.migadu.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "digitalocean_record" "mail-srv-imaps" {
|
resource "digitalocean_record" "mail-srv-imaps" {
|
||||||
domain = digitalocean_domain.default.id
|
domain = digitalocean_domain.default.id
|
||||||
type = "SRV"
|
type = "SRV"
|
||||||
name = "_imaps"
|
name = "_imaps._tcp"
|
||||||
port = 993
|
port = 993
|
||||||
priority = 0
|
priority = 0
|
||||||
weight = 1
|
weight = 1
|
||||||
value = "imap.migadu.com"
|
value = "imap.migadu.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "digitalocean_record" "mail-srv-pop3s" {
|
resource "digitalocean_record" "mail-srv-pop3s" {
|
||||||
domain = digitalocean_domain.default.id
|
domain = digitalocean_domain.default.id
|
||||||
type = "SRV"
|
type = "SRV"
|
||||||
name = "_pop3s"
|
name = "_pop3s._tcp"
|
||||||
port = 995
|
port = 995
|
||||||
priority = 0
|
priority = 0
|
||||||
weight = 1
|
weight = 1
|
||||||
value = "pop.migadu.com"
|
value = "pop.migadu.com"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ terraform {
|
||||||
version = "~> 2.0"
|
version = "~> 2.0"
|
||||||
}
|
}
|
||||||
namecheap = {
|
namecheap = {
|
||||||
source = "namecheap/namecheap"
|
source = "namecheap/namecheap"
|
||||||
version = ">= 2.0.0"
|
version = ">= 2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ provider "acme" {
|
||||||
|
|
||||||
provider "namecheap" {
|
provider "namecheap" {
|
||||||
user_name = var.namecheap_user
|
user_name = var.namecheap_user
|
||||||
api_user = var.namecheap_api_user
|
api_user = var.namecheap_api_user
|
||||||
api_key = var.namecheap_api_key
|
api_key = var.namecheap_api_key
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "do_token" {}
|
variable "do_token" {}
|
||||||
|
|
Loading…
Reference in New Issue