terraform-nomad/Makefile
Ben Vincent 3957aef3c6
Some checks failed
Build / build (pull_request) Failing after 0s
feat: initial setup
- manage nomad jobs
- create makefile
- create gitignore
- manage terragrunt environments
- add build jobs
2024-12-28 14:37:04 +11:00

27 lines
720 B
Makefile

SHELL := /bin/bash
ENVIRONMENT ?= au-syd1
ENV_DIR = environments/$(ENVIRONMENT)
PLAN_DIR = plans
PLAN_FILE = ../../$(PLAN_DIR)/$(ENVIRONMENT).plan
.PHONY: clean
clean:
@echo "Cleaning Terraform files..."
find environments -type f -name '*.tf' -exec rm -f "{}" \; && \
find environments -type f -name '.terraform.lock.hcl' -exec rm -f "{}" \; && \
find environments -type d -name '.terraform' -exec rm -rf "{}" \; && \
rm -rf plans
.PHONY: init
init:
terragrunt --terragrunt-working-dir $(ENV_DIR) init
.PHONY: plan
plan: init
@mkdir -p $(PLAN_DIR)
terragrunt --terragrunt-working-dir $(ENV_DIR) plan -out=$(PLAN_FILE)
.PHONY: apply
apply:
terragrunt --terragrunt-working-dir $(ENV_DIR) apply $(PLAN_FILE)