From 78a0c12fb927ec04ef81a556360ace945b00e41b Mon Sep 17 00:00:00 2001 From: Otho Ulrich Date: Sun, 21 Aug 2022 01:22:38 -0400 Subject: [PATCH] Add dns terraform. --- .gitignore | 3 +++ main.tf | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 main.tf diff --git a/.gitignore b/.gitignore index 3e06bcb..51b01e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .data vhost.d +.terraform +.env +.cache diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..d94fbab --- /dev/null +++ b/main.tf @@ -0,0 +1,64 @@ +resource "namecheap_domain_records" "top" { + domain = "othoulrich.com" + mode = "MERGE" + + record { + address = "otho.boxgraph.net." + hostname = "code" + mx_pref = 10 + ttl = 1799 + type = "CNAME" + } + record { + address = "othoulrich.com." + hostname = "www" + mx_pref = 10 + ttl = 1799 + type = "CNAME" + } + record { + address = "www.othoulrich.com." + hostname = "@" + mx_pref = 10 + ttl = 1799 + type = "CNAME" + } +} + +terraform { + required_providers { + namecheap = { + source = "namecheap/namecheap" + version = "~> 2.1.0" + } + } + + backend "http" { + + } + +} + +provider "namecheap" { + user_name = var.dns_user_name + api_user = var.dns_api_user + api_key = var.dns_api_key + use_sandbox = var.use_dns_sandbox +} + +variable use_dns_sandbox { + type = bool + default = false +} + +variable dns_user_name { + type = string +} + +variable dns_api_user { + type = string +} + +variable dns_api_key { + type = string +}