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
Problem
After PR #1244 lands,
scripts/tf-deploy.shforwards arbitrary extra arguments verbatim to terraform, so-target=...is now a first-class capability of the script. Thefrontend-onlytarget inMakefile.terraform, however, still bypasses the script and invokes terraform directly:So this one target skips:
log_info/ "Deployment Outputs" summary the script prints on successif [ ! -f "$PROFILE_FILE" ])${ENV_DIR}and symlinksmain.tfif missing)terraform initauto-run when.terraformis absentAWS_PROFILEwarningA user who happens to run
make frontend-onlyfirst will get a different (worse) experience than someone who runsmake deployfirst thenmake frontend-only. The duplication also means the path-arithmetic (../../../profiles/...) lives in two places.Fix
Route
frontend-onlythrough the script now that the script supports-target=...:Quick verification:
make -n -f Makefile.terraform frontend-only # expect: ./scripts/tf-deploy.sh aws dev apply -target=module.frontendAnd with a stub
terraformon PATH the recorded invocation should be: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