fix all of ryans problems

This commit is contained in:
Lance Vick 2023-04-13 20:47:41 -07:00
parent fc8903f688
commit bf7262e8ba
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
1 changed files with 11 additions and 8 deletions

View File

@ -11,14 +11,15 @@ KEYS := \
88823A75ECAA786B0FF38B148E401478A3FBEF72 \ 88823A75ECAA786B0FF38B148E401478A3FBEF72 \
3D7C8D39E8C4DF771583D3F0A8A091FD346001CA 3D7C8D39E8C4DF771583D3F0A8A091FD346001CA
ifeq ("$(wildcard $(CACHE_DIR)/secrets/$(ENVIRONMENT).env)","") SKIP_SECRETS=
gpg --decrypt \ ifeq ("$(wildcard $(CACHE_DIR)/secrets/$(ENVIRONMENT).env)$(SKIP_SECRETS)","")
secrets/$(ENVIRONMENT).env.gpg \ noop=$(shell \
> $(CACHE_DIR)/secrets/$(ENVIRONMENT).env $(MAKE) SKIP_SECRETS=1 $(CACHE_DIR)/secrets/$(ENVIRONMENT).env \
)
endif endif
include $(CACHE_DIR)/secrets/$(ENVIRONMENT).env include $(CACHE_DIR)/secrets/$(ENVIRONMENT).env
export $(shell sed 's/=.*//' $(CACHE_DIR)/secrets/$(ENVIRONMENT).env) export $(shell sed 's/=.*//' $(CACHE_DIR)/secrets/$(ENVIRONMENT).env 2>/dev/null)
.DEFAULT_GOAL := .DEFAULT_GOAL :=
.PHONY: default .PHONY: default
@ -67,9 +68,10 @@ infra/backend/$(ENVIRONMENT).tfstate: \
-var region=$(REGION) \ -var region=$(REGION) \
-state ../../$@ -state ../../$@
config/$(ENVIRONMENT).tfbackend: | \ config/$(ENVIRONMENT).tfbackend: \
infra/backend/$(ENVIRONMENT).tfstate \
$(OUT_DIR)/terraform $(OUT_DIR)/terraform
# File is not committed and this has no shared state
$(MAKE) infra/backend/$(ENVIRONMENT).tfstate
env -C infra/backend $(TERRAFORM) \ env -C infra/backend $(TERRAFORM) \
output -state ../../$< \ output -state ../../$< \
> $@ > $@
@ -87,7 +89,8 @@ $(CACHE_DIR)/secrets:
mkdir -p $@ mkdir -p $@
$(CACHE_DIR)/secrets/%.env: secrets/%.env.gpg $(CACHE_DIR)/secrets $(CACHE_DIR)/secrets/%.env: secrets/%.env.gpg $(CACHE_DIR)/secrets
gpg --decrypt $< > $@ @echo "Decrypting $@"
gpg --decrypt $< 2>/dev/null > $@
$(FETCH_DIR)/terraform: $(FETCH_DIR)/terraform:
$(call git_clone,$@,$(TERRAFORM_REPO),$(TERRAFORM_REF)) $(call git_clone,$@,$(TERRAFORM_REPO),$(TERRAFORM_REF))