Files
nomad/e2e/terraform/Makefile
Daniel Bennett afbd283c1b e2e: skip missing windows ami if windows clients=0 (#23610)
and tweak Makefile to generate a custom.tfvars
instead of specifying vars separately via CLI.
hoping this makes it a little more obvious
if there is no consul/nomad license.
2024-07-17 12:45:41 -05:00

55 lines
1.4 KiB
Makefile

PKG_PATH ?= $(shell pwd)/../../pkg/linux_amd64/nomad
NOMAD_LICENSE_PATH ?=
CONSUL_LICENSE_PATH ?=
# deploy for quick local development testing
custom.tfvars:
echo 'nomad_local_binary = "$(PKG_PATH)"' > custom.tfvars
echo 'volumes = false' >> custom.tfvars
echo 'client_count_ubuntu_jammy_amd64 = 3' >> custom.tfvars
echo 'client_count_windows_2016_amd64 = 0' >> custom.tfvars
echo 'consul_license = "$(shell cat $(CONSUL_LICENSE_PATH))"' >> custom.tfvars
echo 'nomad_license = "$(shell cat $(NOMAD_LICENSE_PATH))"' >> custom.tfvars
.PHONY: plan apply clean destroy plan_full apply_full clean_full destroy_full tidy
plan: custom.tfvars
terraform plan -var-file=custom.tfvars
apply: custom.tfvars
terraform apply -var-file=custom.tfvars -auto-approve
destroy: custom.tfvars
terraform destroy -var-file=custom.tfvars -auto-approve
clean: destroy tidy
# deploy what's in E2E nightly
plan_full:
terraform plan
apply_full:
@terraform apply -auto-approve \
-var="consul_license=$(shell cat $(CONSUL_LICENSE_PATH))" \
-var="nomad_license=$(shell cat $(NOMAD_LICENSE_PATH))"
clean_full: destroy_full tidy
destroy_full:
terraform destroy -auto-approve
# util
# don't run this by default in plan/apply because it prevents you from
# updating a running cluster
tidy:
rm -rf keys
mkdir keys
chmod 0700 keys
rm -rf uploads/*
git checkout uploads/README.md
rm -f terraform.tfstate.*.backup
rm custom.tfvars