From c8f7d7f8c3b85470814a14711939d6258af75c2d Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 10 Feb 2024 10:40:04 +0100 Subject: [PATCH] ordo: improve makefile for terraform --- makefile | 2 +- terraform/makefile | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 terraform/makefile diff --git a/makefile b/makefile index bbddcb4..35ad67b 100644 --- a/makefile +++ b/makefile @@ -15,7 +15,7 @@ vagranup: create-dev: vagranup DNS-stagging make -C ansible deploy_staging - make -C terraform deploy_vault + make -C terraform deploy_vault env=stagging create-dev-base: vagranup DNS-stagging make -C ansible deploy_staging_base diff --git a/terraform/makefile b/terraform/makefile new file mode 100644 index 0000000..d10cfd4 --- /dev/null +++ b/terraform/makefile @@ -0,0 +1,15 @@ +env := production + +deploy_vault: +ifneq (,$(wildcard ~/vaultUnseal/$(env)/rootkey)) + VAULT_TOKEN=$(shell cat ~/vaultUnseal/$(env)/rootkey) terraform -chdir=vault apply +else + terraform -chdir=vault apply +endif + +deploy_dns: + TF_VAR_powerDnsApiKey=$(shell vault kv get -field=API_KEY secrets/nomad/pdns) TF_VAR_hcloud_token=$(vault kv get -field=hcloud_token secrets/hetzner) terraform -chdir dns apply + +deploy_cloud: + TF_VAR_hetznerApiKey=$(shell vault kv get -field=hdns_token secrets/hetzner) terraform -chdir=cloud apply +