From e3b6cb72b4b85a8ae8d746ceb98843d4c91335b7 Mon Sep 17 00:00:00 2001 From: Maxine Aubrey Date: Mon, 23 Sep 2024 19:24:30 +0200 Subject: [PATCH] feat(dns): add dnsimple to terraform configuration --- flake.nix | 1 + terraform/default.nix | 1 + terraform/dnsimple.nix | 49 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 terraform/dnsimple.nix diff --git a/flake.nix b/flake.nix index 10fabcf..bad4960 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,7 @@ modules = [ ./terraform { + bagel.dnsimple.enable = true; bagel.gandi.enable = true; bagel.hydra.enable = true; } diff --git a/terraform/default.nix b/terraform/default.nix index da1aa29..95b7df6 100644 --- a/terraform/default.nix +++ b/terraform/default.nix @@ -2,6 +2,7 @@ imports = [ ./common.nix ./gandi.nix + ./dnsimple.nix ./hydra.nix ./state.nix ]; diff --git a/terraform/dnsimple.nix b/terraform/dnsimple.nix new file mode 100644 index 0000000..eab5ac0 --- /dev/null +++ b/terraform/dnsimple.nix @@ -0,0 +1,49 @@ +{ lib, config, ... }: +let + inherit (lib) mkEnableOption mkIf tf genList; + cfg = config.bagel.dnsimple; +in +{ + options.bagel.dnsimple = { + enable = mkEnableOption "the DNSimple configuration"; + }; + + config = mkIf cfg.enable { + terraform.required_providers.dnsimple = { + version = "~> 1.7.0"; + source = "dnsimple/dnsimple"; + }; + + resource.secret_resource.dnsimple_token.lifecycle.prevent_destroy = true; + resource.secret_resource.dnsimple_account.lifecycle.prevent_destroy = true; + + provider.dnsimple = { + token = tf.ref "resource.secret_resource.dnsimple_token.value"; + account = tf.ref "resource.secret_resource.dnsimple_account.value"; + }; + + resource.dnsimple_zone.forkos_org = { + name = "forkos.org"; + }; + + resource.dnsimple_zone.fleurixos_org = { + name = "fleurixos.org"; + }; + + resource.dnsimple_zone.floral_systems = { + name = "floral.systems"; + }; + + resource.dnsimple_zone.flowery_systems = { + name = "flowery.systems"; + }; + + resource.dnsimple_zone.petalpkgs_org = { + name = "petalpkgs.org"; + }; + + resource.dnsimple_zone.vzfdfp_de = { + name = "vzfdfp.de"; + }; + }; +}