feat: opt-in published Terraform modules from approved sources (iteration 8)
Infrastructure code is plain resources by default. An Execution may opt in with terraform_modules; the deployment default is TERRAFORM_MODULES, off. - A module is accepted only from the registry namespaces the provider bundle lists (terraform-google-modules), at one exact version. Any other source is refused before Terraform runs; until now nothing stopped generated code naming any source for terraform init to download. - terraform_module looks up a module's inputs, outputs and submodules from the registry and says when it cannot be used with the pinned provider. - skills/google-cloud-iac-modules: when a module fits, and four modules with examples a test validates against hashicorp/google 8.6.0. - Opted in, the IaC author and validator get the Skill and the lookup. Not opted in, they get neither and a module block is refused in code. - A Change request follows its Baseline. execution.json records the choice. - case-07 runs case 03's request with modules opted into. Azure (aztfm) and AWS (terraform-aws-modules) sources are recorded in the plan for when those Cloud providers are added. No case has run with this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
43
.agents/plans/iter-08-terraform-modules/MAP.md
Normal file
43
.agents/plans/iter-08-terraform-modules/MAP.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Plan Map
|
||||
|
||||
**Iteration:** 8, Terraform modules
|
||||
**Intent:** Let generated infrastructure code call a published Terraform module where one replaces several resources that must be wired together, without losing the Requirements chain or opening a way for arbitrary code to be downloaded.
|
||||
**Status:** steps 1 to 5 built on 2026-10-09; a case run each way is outstanding; steps 6 and 7 wait on those Cloud providers
|
||||
**This directory covers:** steps 1 to 7
|
||||
|
||||
## The owner's request (2026-10-09)
|
||||
|
||||
Use modules, when necessary, from three organisations:
|
||||
|
||||
| Cloud provider | Source | Here |
|
||||
|---|---|---|
|
||||
| Google Cloud | https://github.com/terraform-google-modules | built: the `terraform-google-modules` registry namespace is allowed in `providers/gcp.yaml` |
|
||||
| Azure | https://github.com/aztfm | recorded for step 6: there is no Azure provider bundle |
|
||||
| AWS | https://github.com/terraform-aws-modules | recorded for step 7: there is no AWS provider bundle |
|
||||
|
||||
The owner's decision, 2026-10-09: **plain resources by default, with an opt-in to known approved sources.**
|
||||
|
||||
- **Opt-in per Execution.** A caller sets `terraform_modules`; the deployment's default is `TERRAFORM_MODULES`, off. A Change request does as its Baseline did unless told otherwise.
|
||||
- **Approved sources are the provider bundle's list.** Opted in, a module is still used only from the tested catalogue and only where it replaces three or more resources that depend on each other.
|
||||
- **Google now.** The tooling names no Cloud provider; the bundle and a Skill do (ADR-0002).
|
||||
|
||||
## What was found first
|
||||
|
||||
- `terraform init` downloads and evaluates whatever a `source` names. Before this iteration nothing stopped generated code naming any Git URL.
|
||||
- A module carries its own provider requirements. Of 23 modules in the Google organisation looked at, these require `google` below 8 and cannot be used with the pinned 8.6.0: `lb-http`, `pubsub`, `bigquery`, `kubernetes-engine`, `log-export`, `event-function`, `scheduled-function`, `bastion-host`. So a catalogue has to be tested, whichever rule decides when a module is used.
|
||||
- Code using two modules validated in 11 seconds against the pinned provider, modules downloaded.
|
||||
|
||||
## Status
|
||||
|
||||
| Step | What | Status |
|
||||
|---|---|---|
|
||||
| 1 | Allow modules only from namespaces the bundle lists, at one exact version | built: `check_module_sources` in `app/tools/modules.py`, run before every validate and plan |
|
||||
| 2 | A lookup of what a module accepts | built: the `terraform_module` tool, from the public registry, for the IaC author and the validator |
|
||||
| 3 | A Skill with the catalogue and the rule for when to use one | built: `skills/google-cloud-iac-modules/`, four references, each validated by a test |
|
||||
| 4 | Checks through a module | built as guidance: `implementation.json` names the module input; the validator confirms what the input sets |
|
||||
| 5 | Opt-in per Execution, plain resources by default | built: `terraform_modules` on a start, `/generate`, A2A metadata and an evaluation case; recorded in `execution.json` |
|
||||
| 5a | Run a case each way and see what the agents do with it | not run |
|
||||
| 6 | Azure: `aztfm` | waits on an Azure provider bundle |
|
||||
| 7 | AWS: `terraform-aws-modules` | waits on an AWS provider bundle |
|
||||
|
||||
Detail: `steps/step-1-to-5.md`.
|
||||
Reference in New Issue
Block a user