Skip to content

Route Makefile.terraform frontend-only through scripts/tf-deploy.sh (unify deploy paths) #1298

Description

@cristim

Problem

After PR #1244 lands, scripts/tf-deploy.sh forwards arbitrary extra arguments verbatim to terraform, so -target=... is now a first-class capability of the script. The frontend-only target in Makefile.terraform, however, still bypasses the script and invokes terraform directly:

frontend-only: ## Deploy frontend only
	@echo "🎨 Deploying frontend..."
	@cd terraform/environments/$(PROVIDER)/$(PROFILE) && \
		terraform apply -var-file="../../../profiles/$(PROVIDER)/$(PROFILE).tfvars" -target=module.frontend

So this one target skips:

  • the colored banner / log_info / "Deployment Outputs" summary the script prints on success
  • the profile-existence validation (if [ ! -f "$PROFILE_FILE" ])
  • the environment-directory bootstrap (creates ${ENV_DIR} and symlinks main.tf if missing)
  • the terraform init auto-run when .terraform is absent
  • the AWS_PROFILE warning

A user who happens to run make frontend-only first will get a different (worse) experience than someone who runs make deploy first then make frontend-only. The duplication also means the path-arithmetic (../../../profiles/...) lives in two places.

Fix

Route frontend-only through the script now that the script supports -target=...:

frontend-only: ## Deploy frontend only
	@echo "🎨 Deploying frontend..."
	@./scripts/tf-deploy.sh $(PROVIDER) $(PROFILE) apply -target=module.frontend

Quick verification:

make -n -f Makefile.terraform frontend-only
# expect: ./scripts/tf-deploy.sh aws dev apply -target=module.frontend

And with a stub terraform on PATH the recorded invocation should be:

apply -var-file=<.../aws/dev.tfvars> -target=module.frontend

Out-of-scope for PR #1244

PR #1244 intentionally limited itself to dropping vestigial targets and fixing the silent argument drop. This unification is a small, safe follow-up that becomes possible because of #1244.

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions