1
0
Fork 0

do_dns terraform module

This commit is contained in:
Massaki Archambault 2023-02-17 14:43:19 -05:00
parent f1d559e113
commit 48f92adc24
4 changed files with 104 additions and 0 deletions

View File

@ -1,6 +1,30 @@
# This file is maintained automatically by "terraform init". # This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates. # Manual edits may be lost in future updates.
provider "registry.terraform.io/digitalocean/digitalocean" {
version = "2.26.0"
constraints = "~> 2.0"
hashes = [
"h1:u4iQgY0Z/TLGqZiejnhU+CFob45+AcY8vW6oKHh+whY=",
"zh:10fc569e4669f1589b02e8d7e43398f2140872c3e74d11429ad74d7c0464176e",
"zh:402be0350250b133db11780704f26226a176ba6fa5016aef2be08f79e76edaa6",
"zh:506b886bf77ebad868283310dc886d40a793a98534dab7278eca826d0cdd7049",
"zh:745c82487f8fbfea15de975682bb6ba70ea79acfd783feeee9702a6b42e689c8",
"zh:85ed296ca9fe707afec0b2ca9263ef167e784e474a13d631c051fdbb90ad324d",
"zh:87d1eea592c70508df371793834e4aa73cc7cbd830ce8509950c26172734201e",
"zh:8c72fc549941c69aac988d2908d8922ea1a48338f73e8d2f8e5fb57fb6ac1197",
"zh:8d6b692e5351c92acf0bbc34865136ce7d961f82546c5cbe47f0050a088d46a8",
"zh:92cb56af41969755d803ff8d528f63012fa51e2c5e83861c1fd92df4dc680688",
"zh:9820f10523f7c6bca62c0eb12d8c923bf303846d679778158032e9c2e6ad29b6",
"zh:9ba0fe7fe519509acdc69d9d9d8a5bd0c06673d5730474ec15d6dfc81f790d31",
"zh:a670d7f7deae78285e469d8ff350629c8d34fdc6b0da05ff0b855c7846ff9342",
"zh:bb8bf49bdb163757b214c6f645b25e6a3eb9952ec6d1fb3dade56da33cd26460",
"zh:c347ed08e2b929718eb7c97406574b28c8e08a5c00068a40a9dd934ab487ef6b",
"zh:e4e423fdbcf1cc86c585738a0ea8a29413ac0e478dc338dee5594257a13f2fb3",
"zh:ee42adc96a03b94d0bdfd226bf691687d4b38e46eb81570674ae7a86cd58e3a6",
]
}
provider "registry.terraform.io/hashicorp/aws" { provider "registry.terraform.io/hashicorp/aws" {
version = "4.55.0" version = "4.55.0"
hashes = [ hashes = [

View File

@ -15,3 +15,37 @@ provider "kubernetes" {
module "aws-parameters-external-secrets" { module "aws-parameters-external-secrets" {
source = "./modules/aws-parameters-external-secrets" source = "./modules/aws-parameters-external-secrets"
} }
module "do_dns" {
source = "./modules/do_dns"
root_domain_name = "badjware.dev"
root_domain_ip = "104.152.168.30"
records = {
"mail" = {
type = "CNAME"
value = "@"
}
"public" = {
type = "CNAME"
value = "@"
}
"cloud" = {
type = "A"
value = "159.203.54.249"
}
"code" = {
type = "A"
value = "159.203.54.249"
}
"drone" = {
type = "A"
value = "159.203.54.249"
}
"grafana" = {
type = "A"
value = "159.203.54.249"
}
}
}

View File

@ -0,0 +1,30 @@
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}
resource "digitalocean_domain" "root" {
name = var.root_domain_name
ip_address = var.root_domain_ip
}
resource "digitalocean_record" "mx_root" {
domain = digitalocean_domain.root.name
type = "MX"
name = "@"
priority = 0
value = "mail.${digitalocean_domain.root.name}."
}
resource "digitalocean_record" "records" {
for_each = var.records
domain = digitalocean_domain.root.name
type = each.value.type
name = each.key
value = each.value.value
}

View File

@ -0,0 +1,16 @@
variable "root_domain_name" {
type = string
description = "The DNS root domain"
}
variable "root_domain_ip" {
type = string
description = "The ip the root domain points to"
}
# https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs/resources/record
variable "records" {
type = map(map(string))
description = "A map of DNS records to install"
default = {}
}