ordo: improve makefile for terraform

This commit is contained in:
vincent 2024-02-10 10:40:04 +01:00
parent 2632c6d2b0
commit c8f7d7f8c3
2 changed files with 16 additions and 1 deletions

View File

@ -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

15
terraform/makefile Normal file
View File

@ -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