From 8c3b66dfe2cd29b640eca97514714f60c71be668 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Thu, 18 Aug 2022 18:16:44 +0200 Subject: [PATCH] first namecheap domain added --- main.tf | 6 ++++++ namecheap.tf | 24 ++++++++++++++++++++++++ run_terraform | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 namecheap.tf diff --git a/main.tf b/main.tf index 637aeee..7ecfb91 100644 --- a/main.tf +++ b/main.tf @@ -1,3 +1,9 @@ terraform { backend "pg" {} + required_providers { + namecheap = { + source = "namecheap/namecheap" + version = ">= 2.0.0" + } + } } diff --git a/namecheap.tf b/namecheap.tf new file mode 100644 index 0000000..64af1c2 --- /dev/null +++ b/namecheap.tf @@ -0,0 +1,24 @@ +// https://registry.terraform.io/providers/namecheap/namecheap/latest/docs + +variable "caladan-ip" { + type = string + default = "139.162.137.29" +} + +provider "namecheap" { + user_name = "gthar" + api_user = "gthar" + client_ip = var.caladan-ip + use_sandbox = false +} + +resource "namecheap_domain_records" "monotremata-xyz" { + domain = "monotremata.xyz" + mode = "MERGE" // maybe eventually move to OVERWRITE + + record { + hostname = "@" + type = "A" + address = var.caladan-ip + } +} diff --git a/run_terraform b/run_terraform index 1eb62e5..c3e9e74 100755 --- a/run_terraform +++ b/run_terraform @@ -2,5 +2,7 @@ export HTTP_PROXY=caladan:8888 export HTTPS_PROXY=caladan:8888 +NAMECHEAP_API_KEY=$(pass namecheap.com/api_key) +export NAMECHEAP_API_KEY terraform "$@"