From 06063c888f756ea36e8d41a62e3a1d01025ba3c0 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Thu, 25 Aug 2022 11:46:50 +0200 Subject: [PATCH] added Makefile --- .gitignore | 2 ++ Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 3 files changed, 44 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 187f80f..cee98e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .direnv .terraform .terraform.lock.hcl +tfinit +tfplan diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..23d6333 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +SRC_DIR=tf +SRC=$(shell find $(SRC_DIR) -type f -name "*.tf") + +TERRAFORM=terraform -chdir=$(SRC_DIR) + +PG_USER=terraform +PG_HOST=pg.monotremata.xyz +PG_DB=terraform_backend +PG_PORT=5432 +PG_PASSWD=$(shell pass "$(PG_HOST)/$(PG_USER)") +PG_CONN_STR=postgres://$(PG_USER):$(PG_PASSWD)@$(PG_HOST):$(PG_PORT)/$(PG_DB) + +NAMECHEAP_API_KEY=$(shell pass namecheap.com/api_key) +LINODE_TOKEN=$(shell pass linode.com/token) +VULTR_API_KEY=$(shell pass vultr.com/api_key) + +HTTP_PROXY=caladan:8888 +HTTPS_PROXY=caladan:8888 + +export HTTP_PROXY +export HTTPS_PROXY + +export NAMECHEAP_API_KEY +export LINODE_TOKEN +export VULTR_API_KEY + +.PHONY: apply clean + +apply: $(SRC_DIR)/tfplan $(SRC) + $(TERRAFORM) apply $(