ready to apply

This commit is contained in:
Lance Vick 2023-03-09 23:43:21 -08:00
parent 930d537a55
commit 268faa19b3
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
1 changed files with 20 additions and 5 deletions

View File

@ -6,6 +6,12 @@ REGION := sfo3
ROOT_DIR := $(shell pwd) ROOT_DIR := $(shell pwd)
TERRAFORM := $(ROOT_DIR)/out/terraform TERRAFORM := $(ROOT_DIR)/out/terraform
.DEFAULT_GOAL :=
.PHONY: default
default: \
toolchain \
apply
.PHONY: .PHONY:
clean: clean:
rm -rf $(CACHE_DIR) rm -rf $(CACHE_DIR)
@ -19,6 +25,12 @@ infra/backend/.terraform: \
$(BACKEND_TF) $(BACKEND_TF)
env -C infra/backend $(TERRAFORM) init 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: \ infra/backend/$(ENVIRONMENT).tfstate: \
$(CACHE_DIR)/secrets/credentials.tfvars \ $(CACHE_DIR)/secrets/credentials.tfvars \
$(OUT_DIR)/terraform \ $(OUT_DIR)/terraform \
@ -33,14 +45,17 @@ infra/backend/$(ENVIRONMENT).tfstate: \
config/$(ENVIRONMENT).tfbackend: \ config/$(ENVIRONMENT).tfbackend: \
infra/backend/$(ENVIRONMENT).tfstate \ infra/backend/$(ENVIRONMENT).tfstate \
$(OUT_DIR)/terraform $(OUT_DIR)/terraform
env -C infra/backend $(TERRAFORM) output -state ../../$< > $@ env -C infra/backend $(TERRAFORM) \
output -state ../../$< \
> $@
.PHONY: .PHONY:
plan: \ apply: \
$(CACHE_DIR)/secrets/credentials.tfvars \ $(CACHE_DIR)/secrets/credentials.tfvars \
config/$(ENVIRONMENT).tfbackend \ $(OUT_DIR)/terraform \
$(OUT_DIR)/terraform infra/main/.terraform
env -C infra/main $(TERRAFORM) plan -var-file $< env -C infra/main $(TERRAFORM) apply \
-var-file ../../$<
$(CACHE_DIR)/secrets: $(CACHE_DIR)/secrets:
mkdir -p $@ mkdir -p $@