microsoft / microsoft/GitHub-Copilot-for-Azure
Replace azure-enterprise-infra-planner skill Terraform deploy chain with a script
- Dominant language
- Python
- Stars
- 250
- Forks
- 204
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 67
Description
## Summary
Copilot has identified a portion of a skill that is a good candidate for replacement with a script.
The candidate is the **Terraform deploy chain** in the `azure-enterprise-infra-planner` skill (`references/deployment.md`) — a fixed `init` → `plan` → `apply` command sequence that already ships as parallel bash and PowerShell blocks.
## Candidate description
When deploying the generated Terraform infrastructure, the skill runs a fixed, branch-free command sequence:
1. `cd infra`
2. `terraform init`
3. `terraform plan -var-file=.tfvars -out=tfplan`
4. `terraform apply tfplan`
This is a strong script candidate because it is:
- **Already shipped as parallel bash _and_ PowerShell** blocks (the canonical signal of an un-extracted script).
- **A fixed, ordered chain** with no branching — `init` then `plan` then `apply` of the saved plan file.
- **Output-reducing** — `terraform plan` emits a large diff; a wrapper can surface a concise change summary and gate `apply` behind an explicit confirmation flag.
- **Duplicated** — the `terraform validate` / `terraform plan` preview and `terraform apply -var-file=…` steps are restated in `terraform-generation.md` (L83, L87) and abstractly in `phases/7-deploy.md` (L9).
**Sketch — `deploy-terraform.{sh,ps1}`:**
- **Input:** `--infra-dir` (default `infra`), `--var-file`, `--plan-file` (default `tfplan`), `--apply` (confirmation flag; default preview-only).
- **Output:** the init/validate result, a concise plan summary (adds/changes/destroys), and — only when `--apply` is set — the apply result, with a labeled "applied N changes" digest.
> Choosing the var-file/environment and giving the final "yes, apply" approval stay in prose (passed to the script as parameters/flags). The destructive `apply` must remain behind explicit user confirmation. The script handles only the mechanical init/plan/apply execution and output digesting.
**Note — cross-skill overlap:** This Terraform validate-and-deploy chain parallels the `azure-deploy` skill's Container Apps / Terraform deployment work (#2518) and its shared deploy-verification candidate (#2512). The two skills may be able to share the same IaC-preflight/deploy script family rather than each authoring its own.
## Affected file and lines
- [`references/deployment.md` — Terraform deploy chain, bash + PowerShell (L95–L114)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-enterprise-infra-planner/references/deployment.md#L95-L114)
- [`references/terraform-generation.md` — validate/plan/apply restated (L83, L87)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-enterprise-infra-planner/references/terraform-generation.md#L83-L87)
## Next steps
1. **Evaluate the candidate** — confirm the steps are stable and parameterizable, and that the script captures everything the skill needs.
2. **Create both a bash _and_ a PowerShell version** of the script so the skill works across platforms.
3. **Run integration tests** to verify the scripts behave correctly and the skill still completes end-to-end.
## Background Information
### Why replace regular steps with scripts
Replacing a regular, well-defined series of steps with a script can:
- **Reduce token usage** — the skill no longer needs to spell out each command and parse large command output inline; the agent invokes one script and reads a compact result.
- **Improve reliability** — the logic is written and tested once, instead of being re-derived by the agent on every run.
- **Improve determinism** — the same inputs always produce the same steps and output, removing run-to-run variation.
- **Improve speed of execution** — a single script call replaces multiple round-trips of command generation, execution, and large-output parsing.
### Authoring notes for the scripts
- **Reference scripts with markdown links**, not just a bare path to the script file.
- **Include examples** in the skill showing how to run each script (sample invocation with arguments).
- **Briefly explain what each script does** where it is referenced.
- **The script output should explain what it did**, so the agent and user can understand the result without re-inspecting raw command output.
Contributor guide
Assessment
This issue has not been assessed yet.