From 268faa19b3fe612f9aba0d0ef1c3ad6ec9770946 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 9 Mar 2023 23:43:21 -0800 Subject: [PATCH] ready to apply --- Makefile | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ba6e063..9fd4861 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,12 @@ REGION := sfo3 ROOT_DIR := $(shell pwd) TERRAFORM := $(ROOT_DIR)/out/terraform +.DEFAULT_GOAL := +.PHONY: default +default: \ + toolchain \ + apply + .PHONY: clean: rm -rf $(CACHE_DIR) @@ -19,6 +25,12 @@ infra/backend/.terraform: \ $(BACKEND_TF) env -C infra/backend $(TERRAFORM) init +infra/main/.terraform: \ + $(OUT_DIR)/terraform \ + $(BACKEND_TF) + env -C infra/main $(TERRAFORM) init \ + -backend-config="../../config/$(ENVIRONMENT).tfbackend" + infra/backend/$(ENVIRONMENT).tfstate: \ $(CACHE_DIR)/secrets/credentials.tfvars \ $(OUT_DIR)/terraform \ @@ -33,14 +45,17 @@ infra/backend/$(ENVIRONMENT).tfstate: \ config/$(ENVIRONMENT).tfbackend: \ infra/backend/$(ENVIRONMENT).tfstate \ $(OUT_DIR)/terraform - env -C infra/backend $(TERRAFORM) output -state ../../$< > $@ + env -C infra/backend $(TERRAFORM) \ + output -state ../../$< \ + > $@ .PHONY: -plan: \ +apply: \ $(CACHE_DIR)/secrets/credentials.tfvars \ - config/$(ENVIRONMENT).tfbackend \ - $(OUT_DIR)/terraform - env -C infra/main $(TERRAFORM) plan -var-file $< + $(OUT_DIR)/terraform \ + infra/main/.terraform + env -C infra/main $(TERRAFORM) apply \ + -var-file ../../$< $(CACHE_DIR)/secrets: mkdir -p $@