# infra/Makefile — Go + Pulumi infrastructure-as-code.
#
# Driven directly with `make -C infra <target>` (or via the root Makefile's
# `infra-*` convenience targets). Targets that interact with the live cluster
# run Pulumi against the stack defined in Pulumi.yaml.

.PHONY: help preview up down refresh static test clean tidy

help: ## List available targets
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
		awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-18s\033[0m %s\n", $$1, $$2}'

preview: ## Preview infra changes against the cluster
	pulumi preview

up: ## Deploy/update infra
	pulumi up

down: ## Tear down the stack's resources
	pulumi destroy

refresh: ## Refresh Pulumi state against the live cluster
	pulumi refresh

static: ## Typecheck + vet without Pulumi
	go build -o /dev/null . && go vet ./...

test: ## Run Go unit tests
	go test ./...

clean: ## Remove local Go build artifact
	rm -f desi-explorer-infra

tidy: ## Tidy Go modules
	go mod tidy
