Repository navigation
Route Makefile.terraform frontend-only through scripts/tf-deploy.sh (unify deploy paths) #59
Description
Problem
After PR LeanerCloud/cloud-commitments-cli#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.frontendSo 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 symlinksmain.tfif missing) - the
terraform initauto-run when.terraformis absent - the
AWS_PROFILEwarning
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.frontendQuick verification:
make -n -f Makefile.terraform frontend-only
# expect: ./scripts/tf-deploy.sh aws dev apply -target=module.frontendAnd 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 LeanerCloud/cloud-commitments-cli#1244
PR LeanerCloud/cloud-commitments-cli#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 LeanerCloud/cloud-commitments-cli#1244.
References
- PR fix(deploy): forward extra terraform args, drop vestigial targets cloud-commitments-cli#1244 (fix(deploy): forward extra terraform args, drop vestigial targets)
- Issue HYG-04: Makefile.terraform docker-build/docker-skip/frontend-skip silently drop their -var flag and run a plain full terraform apply cloud-commitments-cli#1172 (HYG-04, parent finding)
Activity
IAmJSD commentedon Oct 23, 2026
Claiming: working on this