From 4e2bd3a448312193b68d54d8a355c3dfe23aaca4 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 30 Nov 2025 17:43:45 +0100 Subject: [PATCH] feat(dns): import ovh opytex registrations --- dns/.terraform.lock.hcl | 22 ++++ dns/local.tf | 12 -- dns/ovh.conf.example | 21 ++++ dns/ovh.tf | 10 ++ dns/ovh_opytex_records.tf | 223 ++++++++++++++++++++++++++++++++++++++ dns/providers.tf | 17 +++ dns/variables.tf | 6 + 7 files changed, 299 insertions(+), 12 deletions(-) create mode 100644 dns/ovh.conf.example create mode 100644 dns/ovh.tf create mode 100644 dns/ovh_opytex_records.tf create mode 100644 dns/providers.tf diff --git a/dns/.terraform.lock.hcl b/dns/.terraform.lock.hcl index e80b711..0439745 100644 --- a/dns/.terraform.lock.hcl +++ b/dns/.terraform.lock.hcl @@ -42,3 +42,25 @@ provider "registry.opentofu.org/gmichels/adguard" { "zh:f809ab383cca0a5f83072981c64208cbd7fa67e986a86ee02dd2c82333221e32", ] } + +provider "registry.opentofu.org/ovh/ovh" { + version = "2.10.0" + constraints = "~> 2.10" + hashes = [ + "h1:6CHM/tHZ7vAvQKtdqurs6ExO+46gpFooZ0zdaW74DKE=", + "zh:1582485c59b5e25fa407417de3040dfc31bfec3f9b884d51953f6625b930d2f6", + "zh:15b425716d5e05992cb1d68a49d58f0e9e0cbd7dbaa35ea9793404fa1ec45bed", + "zh:1c1547ff469c2f772d478f67d148d08b38468d43c9517b723b622a085625d949", + "zh:2491be291a8876da2dc1e71490428706cdca39002a1e89d10dd060474f59ce19", + "zh:2d9c7589764f838f04d38a87a0e6c9db6b560b6c5b510b69eabf2d67caa38d2b", + "zh:56c5b16a55dc4ac5f3eed69072e5ae74aafac2a4a8a84ba27fa06528320037cc", + "zh:629d2c7f709fc01adabba1c8b98ec7485dfebcc4b9f72f4bd4d36509166eb42c", + "zh:82f4b8b35a31a468d7a2a5aa4630f432ef64d9abfed8066afdaab0502886a72a", + "zh:84c5e65122efaee5e34c266cd750576969bd788c2bdbb804a7ffc08728ac3987", + "zh:85db08f3e1b27fda723b080bc5132069b6b7ba9699567cd44fb0a2207456a76c", + "zh:a84c043c96a01230e570163706f58c33ee59699fcc857d3db0f6e0b2a6b08bc6", + "zh:ad984516009930efc6ec465046287c6b293b6b219e3167aa4c0b900b903c6a50", + "zh:bd0114d45ec72134cf930a7619b70b0068e439759febba5717abb76219b85800", + "zh:f243a50dcf87687881972fcaba9226b4247588b6dc7368b0ef98168f643ee159", + ] +} diff --git a/dns/local.tf b/dns/local.tf index cac7e9f..66f8fca 100644 --- a/dns/local.tf +++ b/dns/local.tf @@ -1,15 +1,3 @@ -terraform { - required_providers { - adguard = { - source = "gmichels/adguard" - version = "~> 1.0" - } - pass = { - source = "camptocamp/pass" - version = "~> 2.0" - } - } -} data "pass_password" "adguard" { path = var.adguard_pass_path diff --git a/dns/ovh.conf.example b/dns/ovh.conf.example new file mode 100644 index 0000000..afa5728 --- /dev/null +++ b/dns/ovh.conf.example @@ -0,0 +1,21 @@ +# Configuration pour l'API OVH +# Copiez ce fichier vers ovh.conf et remplissez vos credentials + +# Votre nom de domaine OVH +ZONE="votredomaine.com" + +# Endpoint OVH (ovh-eu pour Europe, ovh-ca pour Canada) +OVH_ENDPOINT="ovh-eu" + +# Credentials de l'API OVH +# Pour créer ces credentials, visitez: https://eu.api.ovh.com/createToken/ +# +# Droits nécessaires: +# GET /domain/zone/* +# POST /domain/zone/* (optionnel, pour créer des enregistrements) +# PUT /domain/zone/* (optionnel, pour modifier des enregistrements) +# DELETE /domain/zone/* (optionnel, pour supprimer des enregistrements) + +OVH_APPLICATION_KEY="votre_application_key" +OVH_APPLICATION_SECRET="votre_application_secret" +OVH_CONSUMER_KEY="votre_consumer_key" diff --git a/dns/ovh.tf b/dns/ovh.tf new file mode 100644 index 0000000..7f2c069 --- /dev/null +++ b/dns/ovh.tf @@ -0,0 +1,10 @@ +data "pass_password" "ovh" { + path = var.ovh_pass_path +} + +provider "ovh" { + endpoint = "ovh-eu" + application_key = data.pass_password.ovh.data.ak + application_secret = data.pass_password.ovh.data.as + consumer_key = data.pass_password.ovh.data.ck +} diff --git a/dns/ovh_opytex_records.tf b/dns/ovh_opytex_records.tf new file mode 100644 index 0000000..5e6af54 --- /dev/null +++ b/dns/ovh_opytex_records.tf @@ -0,0 +1,223 @@ +resource "ovh_domain_zone_record" "git_a" { + zone = "opytex.org" + subdomain = "git" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "root_a" { + zone = "opytex.org" + subdomain = "" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "raw_a" { + zone = "opytex.org" + subdomain = "raw" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "www_cname" { + zone = "opytex.org" + subdomain = "www" + fieldtype = "CNAME" + ttl = 3600 + target = "opytex.org." +} + +resource "ovh_domain_zone_record" "ftp_cname" { + zone = "opytex.org" + subdomain = "ftp" + fieldtype = "CNAME" + ttl = 3600 + target = "opytex.org." +} + +resource "ovh_domain_zone_record" "admin_a" { + zone = "opytex.org" + subdomain = "admin" + fieldtype = "A" + ttl = 3600 + target = "91.121.90.228" +} + +resource "ovh_domain_zone_record" "storage_a" { + zone = "opytex.org" + subdomain = "storage" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "minio_a" { + zone = "opytex.org" + subdomain = "minio" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "chioggia_a" { + zone = "opytex.org" + subdomain = "chioggia" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "chioggia_aaaa" { + zone = "opytex.org" + subdomain = "chioggia" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "sso_a" { + zone = "opytex.org" + subdomain = "sso" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "rss_a" { + zone = "opytex.org" + subdomain = "rss" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "rss_aaaa" { + zone = "opytex.org" + subdomain = "rss" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "bag_a" { + zone = "opytex.org" + subdomain = "bag" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "bag_aaaa" { + zone = "opytex.org" + subdomain = "bag" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "liens_a" { + zone = "opytex.org" + subdomain = "liens" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "liens_aaaa" { + zone = "opytex.org" + subdomain = "liens" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "storage_aaaa" { + zone = "opytex.org" + subdomain = "storage" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "minio_aaaa" { + zone = "opytex.org" + subdomain = "minio" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "git_aaaa" { + zone = "opytex.org" + subdomain = "git" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "paperless_a" { + zone = "opytex.org" + subdomain = "paperless" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "paperless_aaaa" { + zone = "opytex.org" + subdomain = "paperless" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "grafana_a" { + zone = "opytex.org" + subdomain = "grafana" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "grafana_aaaa" { + zone = "opytex.org" + subdomain = "grafana" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "photos_a" { + zone = "opytex.org" + subdomain = "photos" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "photos_aaaa" { + zone = "opytex.org" + subdomain = "photos" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} + +resource "ovh_domain_zone_record" "vault_a" { + zone = "opytex.org" + subdomain = "vault" + fieldtype = "A" + ttl = 3600 + target = "188.165.240.182" +} + +resource "ovh_domain_zone_record" "vault_aaaa" { + zone = "opytex.org" + subdomain = "vault" + fieldtype = "AAAA" + ttl = 3600 + target = "2001:41d0:2:bbb6:0:0:0:1" +} diff --git a/dns/providers.tf b/dns/providers.tf new file mode 100644 index 0000000..a0e30ad --- /dev/null +++ b/dns/providers.tf @@ -0,0 +1,17 @@ +terraform { + required_providers { + adguard = { + source = "gmichels/adguard" + version = "~> 1.0" + } + pass = { + source = "camptocamp/pass" + version = "~> 2.0" + } + ovh = { + source = "ovh/ovh" + version = "~> 2.10" + } + } +} + diff --git a/dns/variables.tf b/dns/variables.tf index a112710..c6d0baf 100644 --- a/dns/variables.tf +++ b/dns/variables.tf @@ -1,3 +1,9 @@ +variable "ovh_pass_path" { + type = string + description = "Path in pass for ovh dns tf creds" + default = "OVH/bb17629-ovh/tf-dns" +} + variable "adguard_pass_path" { type = string description = "Path in pass for AdGuard username"