1
0
Fork 0
distrust-stack/Makefile

48 lines
1.1 KiB
Makefile
Raw Normal View History

2023-02-17 06:09:13 +00:00
BACKEND_TF := $(wildcard infra/backend/*.tf)
ENVIRONMENT := production
include $(PWD)/src/toolchain/Makefile
.PHONY:
clean:
rm -rf $(CACHE_DIR)
.PHONY:
credentials: \
$(CACHE_DIR)/secrets/credentials.tfvars
infra/backend/.terraform: $(BACKEND_TF)
env -C infra/backend terraform init
infra/backend/terraform.tfstate: infra/backend/.terraform
env -C infra/backend terraform apply -state $@ -var-file $<
config/$(ENVIRONMENT).tfbackend: infra/backend/$(ENVIRONMENT).tfstate
env -C infra/backend terraform output -state $< > $@
.PHONY:
plan: $(CACHE_DIR)/secrets/credentials.tfvars config/$(ENVIRONMENT).tfbackend
env -C infra/main terraform plan -var-file $<
$(CACHE_DIR)/secrets:
mkdir -p $@
cache/secrets/%.tfvars: secrets/%.tfvars.gpg $(CACHE_DIR)/secrets
gpg --decrypt $< > $@
$(FETCH_DIR)/terraform:
$(call git_clone,$@,$(TERRAFORM_REPO),$(TERRAFORM_REF))
$(OUT_DIR)/terraform: $(FETCH_DIR)/terraform
$(call toolchain,$(USER)," \
cd $(FETCH_DIR)/terraform && \
export SSL_CERT_DIR=/etc/ssl/certs && \
2023-03-10 03:49:01 +00:00
export CGO_ENABLED=0 && \
go build \
-v \
-trimpath \
-ldflags='-w -extldflags=-static' \
-o /home/build/$@ \
2023-02-17 06:09:13 +00:00
")