From 4d5152449248edaf71781425a61b03229ef1d1d5 Mon Sep 17 00:00:00 2001 From: Benoit Donneaux Date: Fri, 11 Oct 2024 17:37:08 +0200 Subject: [PATCH] More Gandi records after zone creation Signed-off-by: Benoit Donneaux --- terraform/core/dns_tl-org.tf | 31 +++++++++ terraform/core/terraform.tfstate | 115 ++++++++++++++++++++++++++++++- 2 files changed, 143 insertions(+), 3 deletions(-) diff --git a/terraform/core/dns_tl-org.tf b/terraform/core/dns_tl-org.tf index c2ba659..1de2804 100644 --- a/terraform/core/dns_tl-org.tf +++ b/terraform/core/dns_tl-org.tf @@ -1,3 +1,4 @@ +# Manage the domain resource "gandi_domain" "tl-org" { name = "tahoe-lafs.org" owner { @@ -21,3 +22,33 @@ resource "gandi_domain" "tl-org" { zip = "12345" } } + +# Accessing domain data +data "gandi_domain" "tl-org" { + name = gandi_domain.tl-org.name +} + +# Managing DNS zone +resource "gandi_livedns_domain" "tl-org" { + name = data.gandi_domain.tl-org.name + timeouts { + default = "3600s" + } +} + +# Managing the NS records of the zone +resource "gandi_nameservers" "tl-org" { + domain = data.gandi_domain.tl-org.name + nameservers = data.gandi_domain.tl-org.nameservers +} + +# Managing other records of the zone +resource "gandi_livedns_record" "tl-org_A" { + name = "@" + type = "A" + values = [ + "1.2.3.4" + ] + ttl = 3600 + zone = data.gandi_domain.tl-org.name +} diff --git a/terraform/core/terraform.tfstate b/terraform/core/terraform.tfstate index e24fdc2..d1015a0 100644 --- a/terraform/core/terraform.tfstate +++ b/terraform/core/terraform.tfstate @@ -1,10 +1,31 @@ { "version": 4, "terraform_version": "1.7.5", - "serial": 1, + "serial": 2, "lineage": "44b8ddf2-df81-a93d-5caf-89dd4fab333a", "outputs": {}, "resources": [ + { + "mode": "data", + "type": "gandi_domain", + "name": "tl-org", + "provider": "provider[\"registry.terraform.io/go-gandi/gandi\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "tahoe-lafs.org", + "name": "tahoe-lafs.org", + "nameservers": [ + "ns-29-a.gnadi.net", + "ns-70-b.gnadi.net", + "ns-153-c.gnadi.net" + ] + }, + "sensitive_attributes": [] + } + ] + }, { "mode": "managed", "type": "gandi_domain", @@ -70,12 +91,17 @@ "country": "US", "data_obfuscated": true, "email": "contact@example.com", - "extra_parameters": null, + "extra_parameters": { + "birth_city": "", + "birth_country": "", + "birth_date": "", + "birth_department": "" + }, "family_name": "LAFS", "given_name": "Terlog", "mail_obfuscated": true, "organisation": "Tahoe-LAFS", - "phone": "+31234567890", + "phone": "+31.234567890", "state": "", "street_addr": "The place to be, 1", "type": "association", @@ -112,6 +138,89 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMCwiZGVmYXVsdCI6NjAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwfX0=" } ] + }, + { + "mode": "managed", + "type": "gandi_livedns_domain", + "name": "tl-org", + "provider": "provider[\"registry.terraform.io/go-gandi/gandi\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "automatic_snapshots": true, + "id": "tahoe-lafs.org", + "name": "tahoe-lafs.org", + "timeouts": { + "default": null + }, + "ttl": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMCwiZGVmYXVsdCI6NjAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwfSwic2NoZW1hX3ZlcnNpb24iOiIwIn0=", + "dependencies": [ + "data.gandi_domain.tl-org", + "gandi_domain.tl-org" + ] + } + ] + }, + { + "mode": "managed", + "type": "gandi_livedns_record", + "name": "tl-org_A", + "provider": "provider[\"registry.terraform.io/go-gandi/gandi\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "href": "https://api.sandbox.gandi.net/v5/livedns/domains/tahoe-lafs.org/records/@/A/api/v5/domains/tahoe-lafs.org/records/@/A", + "id": "tahoe-lafs.org/@/A", + "mutable": null, + "name": "@", + "timeouts": null, + "ttl": 3600, + "type": "A", + "values": [ + "1.2.3.4" + ], + "zone": "tahoe-lafs.org" + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMCwiZGVmYXVsdCI6NjAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwfX0=", + "dependencies": [ + "data.gandi_domain.tl-org", + "gandi_domain.tl-org" + ] + } + ] + }, + { + "mode": "managed", + "type": "gandi_nameservers", + "name": "tl-org", + "provider": "provider[\"registry.terraform.io/go-gandi/gandi\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "domain": "tahoe-lafs.org", + "id": "tahoe-lafs.org", + "nameservers": [ + "ns-29-a.gnadi.net", + "ns-70-b.gnadi.net", + "ns-153-c.gnadi.net" + ], + "timeouts": null + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMCwiZGVmYXVsdCI6NjAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwfX0=", + "dependencies": [ + "data.gandi_domain.tl-org", + "gandi_domain.tl-org" + ] + } + ] } ], "check_results": null