resource "digitalocean_domain" "scipiocapital" {
  name = "scipiocapital.us"
}

# ==========================================================================
# Standard hostname configuration
resource "digitalocean_record" "scipiocapital" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "A"
  name   = "@"
  value  = "24.2.156.189"
  ttl    = 3600
}

resource "digitalocean_record" "scipiocapital_app" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "CNAME"
  name   = "app"
  value  = "en1.enp.one."
  ttl    = 43200
}

resource "digitalocean_record" "scipiocapital_notify" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "CNAME"
  name   = "notify"
  value  = "en1.enp.one."
  ttl    = 43200
}

resource "digitalocean_record" "scipiocapital_docs" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "CNAME"
  name   = "docs"
  value  = "${digitalocean_record.enp_en1.fqdn}."
  ttl    = 43200
}

resource "digitalocean_record" "scipiocapital_auth" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "CNAME"
  name   = "auth"
  value  = "${digitalocean_record.enp_en1.fqdn}."
  ttl    = 43200
}

# ==========================================================================
# Standard DO configuration for all managed domains, includes
# NS records and SOA
resource "digitalocean_record" "scipiocapital_ns1" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "NS"
  name   = "@"
  value  = "ns1.digitalocean.com."
  ttl    = 1800
}

resource "digitalocean_record" "scipiocapital_ns2" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "NS"
  name   = "@"
  value  = "ns2.digitalocean.com."
  ttl    = 1800
}

resource "digitalocean_record" "scipiocapital_ns3" {
  domain = digitalocean_domain.scipiocapital.id
  type   = "NS"
  name   = "@"
  value  = "ns3.digitalocean.com."
  ttl    = 1800
}
