Added terraform configuration for domains

This commit is contained in:
2023-10-30 20:26:34 +01:00
parent 40a0d3cde7
commit ff434ab5f8
5 changed files with 143 additions and 0 deletions
View File
+9
View File
@@ -0,0 +1,9 @@
import {
to = inwx_domain.twomartens_de
id = "2martens.de"
}
import {
to = inwx_domain.twomartens_eu
id = "2martens.eu"
}
+101
View File
@@ -0,0 +1,101 @@
terraform {
required_providers {
inwx = {
source = "inwx/inwx"
version = "1.3.2"
}
}
}
provider "inwx" {
api_url = "https://api.domrobot.com/jsonrpc/"
username = var.inwx_user
password = var.inwx_password
# Configuration options
}
locals {
domain_period = "1Y"
domain_renewal = "AUTORENEW"
}
resource "inwx_domain_contact" "admin" {
// contact configuration
type = "PERSON"
name = var.admin_name
street_address = var.admin_street
city = var.admin_city
postal_code = var.admin_postal_code
country_code = var.admin_country_code
phone_number = var.admin_phone_number
email = var.admin_email
}
resource "inwx_domain_contact" "inwx" {
// contact configuration
type = "ORG"
name = "Hostmaster Of The Day"
organization = "INWX GmbH"
street_address = "Prinzessinnenstr. 30"
city = "Berlin"
postal_code = "10969"
country_code = 'DE'
phone_number = "+49.309832120"
email = "hostmaster@inwx.de"
}
resource "inwx_domain" "twomartens_de" {
name = "2martens.de"
nameservers = [
"ns.inwx.de",
"ns2.inwx.de",
"ns3.inwx.eu"
]
period = local.domain_period
renewal_mode = local.domain_renewal
transfer_lock = true
contacts {
// references to terraform managed contact "example_person"
registrant = inwx_domain_contact.admin.id
admin = inwx_domain_contact.admin.id
tech = inwx_domain_contact.inwx.id
billing = inwx_domain_contact.inwx.id
}
extra_data = {
// Enable e.g. whois protection
"WHOIS-PROTECTION": "1" // 1 == bool true
}
lifecycle {
ignore_changes = [
extra_data["WHOIS-CURRENCY"], // ignore WHOIS-CURRENCY
]
}
}
resource "inwx_domain" "twomartens_eu" {
name = "2martens.eu"
nameservers = [
"ns.inwx.de",
"ns2.inwx.de",
"ns3.inwx.eu"
]
period = local.domain_period
renewal_mode = local.domain_renewal
transfer_lock = true
contacts {
// references to terraform managed contact "example_person"
registrant = inwx_domain_contact.admin.id
admin = inwx_domain_contact.admin.id
tech = inwx_domain_contact.inwx.id
billing = inwx_domain_contact.inwx.id
}
extra_data = {
// Enable e.g. whois protection
"WHOIS-PROTECTION": "1" // 1 == bool true
}
lifecycle {
ignore_changes = [
extra_data["WHOIS-CURRENCY"], // ignore WHOIS-CURRENCY
]
}
}
View File
+33
View File
@@ -0,0 +1,33 @@
variable "inwx_user" {
type = string
sensitive = true
}
variable "inwx_password" {
type = string
sensitive = true
}
variable "admin_name" {
type = string
sensitive = true
}
variable "admin_street" {
type = string
sensitive = true
}
variable "admin_city" {
type = string
}
variable "admin_postal_code" {
type = string
}
variable "admin_country_code" {
type = string
}
variable "admin_phone_number" {
type = string
sensitive = true
}
variable "admin_email" {
type = string
sensitive = true
}