✦ Sample Prompt
Update the IaC `Makefile` in every infrastructure repo to match the canonical
template.
Canonical targets (customize before running):
.PHONY: init plan apply fmt validate destroy
init:
tfenv install && terraform init -upgrade
plan:
terraform plan -var-file=terraform.tfvars -out=plan.out
apply:
terraform apply plan.out
fmt:
terraform fmt -recursive
validate:
terraform fmt -check -recursive && terraform validate
For each repository:
1. Locate the IaC `Makefile` at the repo root (or `infra/Makefile`,
`terraform/Makefile`).
2. Replace these targets with the canonical versions: `init`, `plan`, `apply`,
`fmt`, `validate`. Preserve any custom targets unless they conflict.
3. Update `.PHONY:` to list every target the Makefile defines.
4. Preserve blocks marked with `# tidra:keep` and `# tidra:end` comments verbatim.
5. If the repo uses `asdf` or `mise` instead of `tfenv`, substitute the appropriate
install command in the `init` target (configurable in the prompt).
6. Skip repos whose Makefile already matches the template. The Problem
The `Makefile` in each IaC repo is the human and CI interface to the resource: `make plan`, `make apply`, `make fmt`. Over time these drift, some repos use `terraform` directly, others use `tfenv`, some pin `-var-file` flags inconsistently, and the `fmt` target sometimes runs `terraform fmt` without `-recursive`.
Bringing every Makefile in line with the current standard means a small but consistent set of edits across every IaC repo.
What Tidra Does
- Locates the IaC
Makefilein every infra repo - Replaces drifted targets (
plan,apply,fmt,validate,init) with the canonical versions from a template you provide - Preserves repo-specific extras (custom targets, env-var defaults) by merging rather than overwriting
- Updates the shebang line and the
.PHONYdeclaration to match the new target list - Opens one PR per repo with a unified diff showing exactly what changed
Before & After
diff
Makefile
- .PHONY: plan apply
+ .PHONY: init plan apply fmt validate
+ init:
+ tfenv install && terraform init -upgrade
+
plan:
- terraform plan
+ terraform plan -var-file=terraform.tfvars -out=plan.out
apply:
- terraform apply
+ terraform apply plan.out
+ fmt:
+ terraform fmt -recursive
Customization Tips
- Template Makefile: Point Tidra at the canonical Makefile template. It will diff each repo against the template and converge.
- Repo-specific extras: Mark extras to preserve with a
# tidra:keepcomment block. Tidra will leave them alone. - tfenv vs asdf: If your org uses
asdformiseinstead oftfenv, swap theinittarget accordingly.