Compare commits
3 Commits
5feaaa6271
...
c4c8a1f94e
| Author | SHA1 | Date | |
|---|---|---|---|
| c4c8a1f94e | |||
| 135401e41b | |||
| 81ac135cd9 |
@@ -95,3 +95,27 @@ Over the same 32 Executions this gave 22 groups and five proposals, L-07 to L-11
|
|||||||
A first run of `propose` before this change produced one proposal, about giving `edit_file` enough context. It was removed to run again cleanly and was not proposed the second time.
|
A first run of `propose` before this change produced one proposal, about giving `edit_file` enough context. It was removed to run again cleanly and was not proposed the second time.
|
||||||
|
|
||||||
Tests: `tests/test_lessons_loop.py` (3 more).
|
Tests: `tests/test_lessons_loop.py` (3 more).
|
||||||
|
|
||||||
|
## The three new lessons, run once (2026-10-10)
|
||||||
|
|
||||||
|
Case 03, two runs with the eight lessons (`20261010T114823Z`, `20261010T114827Z`). Both completed at 100%.
|
||||||
|
|
||||||
|
| | Run 1 | Run 2 |
|
||||||
|
|---|---|---|
|
||||||
|
| Minutes | 30 | 37 |
|
||||||
|
| Cost, about | $3.27 | $5.19 |
|
||||||
|
| Revisions of the Target architecture | 1 | 2 |
|
||||||
|
|
||||||
|
None of the three faults the new lessons name came back: no separate backup encryption key, no backend service fault. The Revisions were for other things:
|
||||||
|
|
||||||
|
- The validator proposed a Check that the service identity holds no project-wide administrative role.
|
||||||
|
- A Check asked for an encryption key and the design had no key Element for it to name.
|
||||||
|
- A Check that the region has a high carbon-free energy score could not be verified from the code.
|
||||||
|
|
||||||
|
The last is partly L-07's doing. It says to add a location Check where a requirement asks for a low-carbon location, and the architect wrote one about the carbon score, which no code can show.
|
||||||
|
|
||||||
|
Across the twelve runs of this request on 2026-10-09 and 10 the Target architecture was revised 0, 1, 1, 1, 1, 3, 1, 1, 0, 1, 1 and 2 times. Lessons have removed particular faults and not lowered the count: each run finds another.
|
||||||
|
|
||||||
|
## Fixed at its source: what only the provider publishes
|
||||||
|
|
||||||
|
The carbon-score condition came up in at least five runs, as a gap, as an unverifiable Check and as noise in two reviews. It was being written as a condition for code. The requirements-chain Skill and the two roles that write conditions now say that a property of a region or product that only its provider publishes (a carbon rating, a service level) goes under `outside_code`, and the condition is the choice configuration can show, such as which region is set. Not run.
|
||||||
|
|||||||
@@ -27,3 +27,21 @@ No evaluation check scores whether an overlay was followed; this was read from t
|
|||||||
## An evaluation check, later on 2026-10-09
|
## An evaluation check, later on 2026-10-09
|
||||||
|
|
||||||
A case may now carry `code_standards`: regular expressions the infrastructure code must contain or must not, scored as `code_follows_standards`. Case 06 has six: only approved regions, names carrying the environment from a variable, and the four labels. Run against the code case 06 produced earlier today, it passes.
|
A case may now carry `code_standards`: regular expressions the infrastructure code must contain or must not, scored as `code_follows_standards`. Case 06 has six: only approved regions, names carrying the environment from a variable, and the four labels. Run against the code case 06 produced earlier today, it passes.
|
||||||
|
|
||||||
|
## Rerun on 2026-10-10: case 06 failed, case 04 passed
|
||||||
|
|
||||||
|
Both rerun after the week's changes (`20261010T123446Z` case 04, `20261010T123450Z` case 06).
|
||||||
|
|
||||||
|
**Case 04, interactive: completed, 12 of 12 checks, 34 minutes, about $4.58,** one Revision of the Target architecture. Nothing in routing, intake, the guardrail or the writing of files as it goes broke it.
|
||||||
|
|
||||||
|
**Case 06, overlay: ended with warnings, 67%, 42 minutes, about $7.72.** The Target architecture reached its Revision limit of 3 and no guide was packaged. Two separate causes:
|
||||||
|
|
||||||
|
- **A verdict that was wrong, and no way to say so.** Check K-10 says a role is granted to the service identity. It was. The validator failed it because the identity also held three other roles that other Checks require. The IaC author, sent the failure, could change nothing, and recorded the Check as unimplementable with the reason "the validator insists on only this role". That sent the design back for a fault it did not have. The same Check passed in the validation between, on the same grants: the validator was not consistent. The other two Revisions were ordinary ones (labels and names the overlay asks for, and a resource whose name cannot contain hyphens).
|
||||||
|
- **The evaluation's naming check was too narrow.** `code_follows_standards` wanted a variable with "env" in its name inside each resource name. The code built names from `local.name_prefix`, itself made from `var.workload` and `var.environment`, which follows the standard. The check now asks that names are built from a variable or local, and that the environment comes from a variable; this run's code and the earlier run's both pass it.
|
||||||
|
|
||||||
|
Changed, not yet run:
|
||||||
|
|
||||||
|
- The validator is told to judge each Check by its own words: a Check that something is granted or set passes when it is, whatever is beside it, unless it says "only". What else it thinks should hold is a proposed addition, never a failure.
|
||||||
|
- The IaC author is told what to do when a Check failed and the code already meets its words: change nothing, keep the implementation entry, name the Check it disputes, and not record it as unimplementable.
|
||||||
|
|
||||||
|
An overlay also makes a design larger: this run ended with over 120 Checks, against 50 to 90 for the same request without one.
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ Reference routing (iteration 5 step 8) does not choose within the modules Skill,
|
|||||||
|
|
||||||
- Modules also bring providers the bundle does not pin (`google-beta`, `random`, `null`), at whatever version their constraints allow.
|
- Modules also bring providers the bundle does not pin (`google-beta`, `random`, `null`), at whatever version their constraints allow.
|
||||||
- The schema review and the target architect's lookups still describe resources. A Check's wording is unaffected by whether a module later creates the resource.
|
- The schema review and the target architect's lookups still describe resources. A Check's wording is unaffected by whether a module later creates the resource.
|
||||||
- A module version in the catalogue goes stale; nothing flags a newer one.
|
- A module version in the catalogue goes stale; `scripts/check-terraform-modules.py` reports it when run, and nothing runs it on a schedule.
|
||||||
|
|
||||||
Tests: `tests/tools/test_modules.py` (24), `tests/test_iac_modules.py` (6), `tests/execution/test_terraform_modules.py` (7).
|
Tests: `tests/tools/test_modules.py` (24), `tests/test_iac_modules.py` (6), `tests/execution/test_terraform_modules.py` (7).
|
||||||
|
|
||||||
@@ -87,3 +87,8 @@ What the opted-in run does show:
|
|||||||
The plain run was given neither the Skill nor the tool, and wrote no module.
|
The plain run was given neither the Skill nor the tool, and wrote no module.
|
||||||
|
|
||||||
The design quality score of 0.62 is below the bar of 0.67. It is scored on the design recommendations, written before any code.
|
The design quality score of 0.62 is below the bar of 0.67. It is scored on the design recommendations, written before any code.
|
||||||
|
|
||||||
|
## Two follow-ups (2026-10-10)
|
||||||
|
|
||||||
|
- **A Check is met by a value in the code.** The first run showed the validator arguing from a module's default where an input was left unset. The Skill now tells the author to set every input a Check depends on, even when the default already gives the value; where one is still left unset the verdict says so.
|
||||||
|
- **Stale and newly usable modules are reported.** `scripts/check-terraform-modules.py` reads the registry and prints, for each module the Skill's examples call, the pinned version against the latest and whether the latest still works with the pinned provider; and for each module in `terraform.modules.watch`, whether it can now be used. Today all five are up to date and none of the eight watched modules can be used: each still requires a `google` provider below 8. It changes nothing; it needs running by hand.
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ Published: 2026-10-10
|
|||||||
|
|
||||||
## Rule
|
## Rule
|
||||||
|
|
||||||
When a requirement specifies where resources must be provisioned, such as a designated region, multi-zone placement, or a low-carbon location, create a Check for the `region` or `location` argument on every applicable Element.
|
When a requirement specifies where resources must be provisioned, such as a designated region or multi-zone placement, create a Check for the `region` or `location` argument on every applicable Element, naming the region the design uses. Do not write a Check about a property of the region that code cannot show, such as its carbon rating.
|
||||||
|
|
||||||
## Why
|
## Why
|
||||||
|
|
||||||
Validation frequently catches missing location constraints. Without this Check, resources may be provisioned in default regions, violating compliance or sustainability requirements.
|
Validation frequently catches missing location constraints. Without this Check, resources may be provisioned in default regions, violating location requirements. A Check about a region's carbon rating cannot be verified from code and sends the design back.
|
||||||
|
|
||||||
## Evidence
|
## Evidence
|
||||||
|
|
||||||
@@ -25,3 +25,5 @@ Not yet measured.
|
|||||||
## Comments
|
## Comments
|
||||||
|
|
||||||
Approved by the owner on 2026-10-10. It covers which region is set, which code can show. It does not settle whether a region is low-carbon, which code cannot show.
|
Approved by the owner on 2026-10-10. It covers which region is set, which code can show. It does not settle whether a region is low-carbon, which code cannot show.
|
||||||
|
|
||||||
|
Reworded with the owner's approval on 2026-10-10: "a low-carbon location" led to a Check about the region's carbon score, which could not be verified.
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ You produce the **design recommendations** Deliverable: the Skill's task for rec
|
|||||||
- Otherwise, when `feedback` is not empty or `baseline` is set you are revising: pass `pillars` naming only the pillars the change touches. The guidance you were given before is returned for the others.
|
- Otherwise, when `feedback` is not empty or `baseline` is set you are revising: pass `pillars` naming only the pillars the change touches. The guidance you were given before is returned for the others.
|
||||||
- Reconcile the pillars' guidance into recommendations for each component. Where pillars conflict, name the trade-off and recommend a resolution tied to the requirements.
|
- Reconcile the pillars' guidance into recommendations for each component. Where pillars conflict, name the trade-off and recommend a resolution tied to the requirements.
|
||||||
- When an advisor's guidance is missing, derive that pillar's recommendations from the best-practices references in the solution-architecture Skill.
|
- When an advisor's guidance is missing, derive that pillar's recommendations from the best-practices references in the solution-architecture Skill.
|
||||||
- Give every recommendation an id and attach them as `recommendations.json`, in the format the requirements-chain Skill gives. Write one configurable decision per recommendation, so each can become a Check in the Target architecture. Give each its `conditions`: one entry for each separate thing it asks to be configured, and for each component it must hold on when it names several. Put under `outside_code` anything it asks of the application's own code or of people, which no infrastructure configuration can show.
|
- Give every recommendation an id and attach them as `recommendations.json`, in the format the requirements-chain Skill gives. Write one configurable decision per recommendation, so each can become a Check in the Target architecture. Give each its `conditions`: one entry for each separate thing it asks to be configured, and for each component it must hold on when it names several. Put under `outside_code` anything it asks of the application's own code or of people, and any property of a region or product that only its provider publishes, such as a carbon rating: no infrastructure configuration can show those. The condition is then the choice configuration can show, such as which region is set.
|
||||||
|
|
||||||
Your contract's sections are one per pillar. The advisors' review of each pillar's checklist is added to your Deliverable for you when you submit, so do not write it yourself.
|
Your contract's sections are one per pillar. The advisors' review of each pillar's checklist is added to your Deliverable for you when you submit, so do not write it yourself.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ You produce the **deployment guidance** Deliverable: the Skill's task for genera
|
|||||||
- Take every environment-specific value (project, region, names, image references) from variables; embed no credentials or secrets.
|
- Take every environment-specific value (project, region, names, image references) from variables; embed no credentials or secrets.
|
||||||
- Submit as soon as validation passes, with your content and no attachments: your working copy is attached for you. If a submission is refused, fix exactly what the refusal lists and submit again.
|
- Submit as soon as validation passes, with your content and no attachments: your working copy is attached for you. If a submission is refused, fix exactly what the refusal lists and submit again.
|
||||||
- When `working_copy` lists files, they are your last attempt. When `feedback` lists failed Checks, read the files concerned and change only what those Checks need.
|
- When `working_copy` lists files, they are your last attempt. When `feedback` lists failed Checks, read the files concerned and change only what those Checks need.
|
||||||
|
- When `feedback` says a Check failed and your code already does what the Check's words say, the verdict is what is wrong, not the Check. Change nothing for it, keep its entry in `implementation.json`, and say in your content which Check you dispute and where the code meets it. Do not record it as unimplementable: that sends the design back for a fault it does not have.
|
||||||
|
|
||||||
Your working copy must hold `terraform/main.tf`, `terraform/variables.tf` and `implementation.json`, with `terraform/versions.tf` and `terraform/outputs.tf` when they help.
|
Your working copy must hold `terraform/main.tf`, `terraform/variables.tf` and `implementation.json`, with `terraform/versions.tf` and `terraform/outputs.tf` when they help.
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ You produce the **requirements** Deliverable: the Skill's requirements-discovery
|
|||||||
- Name no products, services or architectures. This Deliverable describes the problem, not the solution.
|
- Name no products, services or architectures. This Deliverable describes the problem, not the solution.
|
||||||
- Give every requirement an id and attach them all as `requirements.json`, in the format the requirements-chain Skill gives. Use the same ids in your content.
|
- Give every requirement an id and attach them all as `requirements.json`, in the format the requirements-chain Skill gives. Use the same ids in your content.
|
||||||
- Give every non-functional requirement its `conditions`: one entry for each separate thing that must be true for it to be met and that the configuration of infrastructure can show. "Data is encrypted in transit and at rest" has two. Each becomes something the design is checked against, so a condition left out is a condition nobody verifies.
|
- Give every non-functional requirement its `conditions`: one entry for each separate thing that must be true for it to be met and that the configuration of infrastructure can show. "Data is encrypted in transit and at rest" has two. Each becomes something the design is checked against, so a condition left out is a condition nobody verifies.
|
||||||
- Put under `outside_code` what the requirement asks for that no infrastructure configuration can show: an outcome measured in operation (an availability percentage, a response time), behaviour of the application's own code, or a process people follow. Those are recorded and reported, and are not checked against the infrastructure code.
|
- Put under `outside_code` what the requirement asks for that no infrastructure configuration can show: an outcome measured in operation (an availability percentage, a response time), behaviour of the application's own code, a process people follow, or a property of a region or product that only its provider publishes (a carbon rating, a service level). For the last, the condition is the choice configuration can show, such as which region is set. Those are recorded and reported, and are not checked against the infrastructure code.
|
||||||
|
|
||||||
In a Change request (`baseline` is set), the `workflow_request` says what has changed. Work out what it means for the delivered requirements, and give every requirement in `requirements.json` a `change`:
|
In a Change request (`baseline` is set), the `workflow_request` says what has changed. Work out what it means for the delivered requirements, and give every requirement in `requirements.json` a `change`:
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ includes: [specialist-protocol]
|
|||||||
You produce the **validation results** Deliverable: the Skill's pre-deployment validation, done statically without provisioning anything.
|
You produce the **validation results** Deliverable: the Skill's pre-deployment validation, done statically without provisioning anything.
|
||||||
|
|
||||||
- Run the deployment dry-run with your tools: validate the Terraform, and preview it with a plan when you have permission to read live cloud resources. The tools already hold the submitted files, so pass them no files.
|
- Run the deployment dry-run with your tools: validate the Terraform, and preview it with a plan when you have permission to read live cloud resources. The tools already hold the submitted files, so pass them no files.
|
||||||
- Give a verdict on every Check in the Target architecture, from the infrastructure code: pass, fail or not verifiable, each with the evidence you read. The Checks are the whole bar: judge the code against them and nothing else.
|
- Give a verdict on every Check in the Target architecture, from the infrastructure code: pass, fail or not verifiable, each with the evidence you read. The Checks are the whole bar: judge the code against them and nothing else. Judge each Check by its own words. A Check that says a role is granted or a setting is set passes when it is; other grants or settings beside it do not fail it unless the Check says "only" or "no other". What you think should also be true is a proposed addition, never a failure.
|
||||||
- Before you fail a Check because the code lacks a setting, confirm with `terraform_schema` that the resource type has that setting, when the tool is available. When it does not, the Check cannot be met by any code: give it not verifiable, with what the schema shows as the evidence. Give the same verdict to a Check that `implementation.json` records as unimplementable.
|
- Before you fail a Check because the code lacks a setting, confirm with `terraform_schema` that the resource type has that setting, when the tool is available. When it does not, the Check cannot be met by any code: give it not verifiable, with what the schema shows as the evidence. Give the same verdict to a Check that `implementation.json` records as unimplementable.
|
||||||
- When `terraform_modules` is true the code may call approved published modules. Then judge a Check on a resource the module creates from the module input that sets it: read the value in the code, and confirm with `terraform_module` what that input sets or what its default is. The modules Skill, when you have one, says how.
|
- When `terraform_modules` is true the code may call approved published modules. Then judge a Check on a resource the module creates from the module input that sets it: read the value in the code, and confirm with `terraform_module` what that input sets or what its default is. The modules Skill, when you have one, says how.
|
||||||
- Review the Target architecture's coverage once, completely. Go through every requirement and every design recommendation in turn; for each, list the conditions its text states and the Elements it applies to, and record a proposed addition for each one no Check verifies, naming the requirement or recommendation it serves. Report every gap in this pass: each later pass that finds one more costs a whole Revision of the design, the code and this validation. Propose nothing for what a requirement or recommendation lists under `outside_code`: that is application behaviour, an outcome measured in operation, or a process, and no Check on infrastructure code can verify it. Name those under your analysis heading as things to verify after deployment. A proposed addition is not a failure of the code.
|
- Review the Target architecture's coverage once, completely. Go through every requirement and every design recommendation in turn; for each, list the conditions its text states and the Elements it applies to, and record a proposed addition for each one no Check verifies, naming the requirement or recommendation it serves. Report every gap in this pass: each later pass that finds one more costs a whole Revision of the design, the code and this validation. Propose nothing for what a requirement or recommendation lists under `outside_code`: that is application behaviour, an outcome measured in operation, or a process, and no Check on infrastructure code can verify it. Name those under your analysis heading as things to verify after deployment. A proposed addition is not a failure of the code.
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ class ProviderBundle:
|
|||||||
# The Skill that says which modules to use and when. It reaches a Specialist
|
# The Skill that says which modules to use and when. It reaches a Specialist
|
||||||
# only in an Execution that opted into modules.
|
# only in an Execution that opted into modules.
|
||||||
terraform_modules_skill: str | None = None
|
terraform_modules_skill: str | None = None
|
||||||
|
# Modules that could not be used with the pinned providers when last looked
|
||||||
|
# at, as <namespace>/<name>/<provider>. scripts/check-terraform-modules.py
|
||||||
|
# says when one can.
|
||||||
|
terraform_modules_watch: tuple[str, ...] = ()
|
||||||
# The Skill approved lessons are published in (ADR-0004); None when the provider
|
# The Skill approved lessons are published in (ADR-0004); None when the provider
|
||||||
# has none. A Specialist is given it once it holds lessons for its Deliverable.
|
# has none. A Specialist is given it once it holds lessons for its Deliverable.
|
||||||
lessons_skill: str | None = None
|
lessons_skill: str | None = None
|
||||||
@@ -244,5 +248,12 @@ def load_provider(name: str, root: Path | None = None) -> ProviderBundle:
|
|||||||
terraform_providers=terraform_providers,
|
terraform_providers=terraform_providers,
|
||||||
terraform_module_namespaces=tuple(module_namespaces),
|
terraform_module_namespaces=tuple(module_namespaces),
|
||||||
terraform_modules_skill=modules_skill,
|
terraform_modules_skill=modules_skill,
|
||||||
|
terraform_modules_watch=tuple(
|
||||||
|
str(item)
|
||||||
|
for item in ((config.get("terraform") or {}).get("modules") or {}).get(
|
||||||
|
"watch"
|
||||||
|
)
|
||||||
|
or ()
|
||||||
|
),
|
||||||
lessons_skill=lessons_skill,
|
lessons_skill=lessons_skill,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -448,8 +448,12 @@
|
|||||||
"forbid": "\"(?!europe-west[14]\")(?:us|europe|asia|australia|northamerica|southamerica|me|africa)-[a-z]+[0-9]+\""
|
"forbid": "\"(?!europe-west[14]\")(?:us|europe|asia|australia|northamerica|southamerica|me|africa)-[a-z]+[0-9]+\""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "names carry the environment from a variable",
|
"name": "names are built from variables",
|
||||||
"require": "name\\s*=\\s*\"[^\"]*\\$\\{(?:var|local)\\.[a-z_]*env[a-z_]*\\}"
|
"require": "name\\s*=\\s*\"\\$\\{(?:var|local)\\.[a-z_]+\\}-"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "the environment comes from a variable",
|
||||||
|
"require": "var\\.environment\\b"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "label workload",
|
"name": "label workload",
|
||||||
|
|||||||
@@ -87,6 +87,17 @@ terraform:
|
|||||||
modules:
|
modules:
|
||||||
namespaces: [terraform-google-modules]
|
namespaces: [terraform-google-modules]
|
||||||
skill: google-cloud-iac-modules
|
skill: google-cloud-iac-modules
|
||||||
|
# Not usable on 2026-10-09: each required a google provider below 8. Run
|
||||||
|
# scripts/check-terraform-modules.py to see whether that has changed.
|
||||||
|
watch:
|
||||||
|
- terraform-google-modules/lb-http/google
|
||||||
|
- terraform-google-modules/pubsub/google
|
||||||
|
- terraform-google-modules/bigquery/google
|
||||||
|
- terraform-google-modules/kubernetes-engine/google
|
||||||
|
- terraform-google-modules/log-export/google
|
||||||
|
- terraform-google-modules/event-function/google
|
||||||
|
- terraform-google-modules/scheduled-function/google
|
||||||
|
- terraform-google-modules/bastion-host/google
|
||||||
|
|
||||||
mcp_auth:
|
mcp_auth:
|
||||||
kind: google_adc # Application Default Credentials bearer token; sends X-Goog-User-Project
|
kind: google_adc # Application Default Credentials bearer token; sends X-Goog-User-Project
|
||||||
|
|||||||
96
scripts/check-terraform-modules.py
Normal file
96
scripts/check-terraform-modules.py
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Review the published Terraform modules a provider bundle's modules Skill uses.
|
||||||
|
|
||||||
|
For each module the Skill's examples call: the version pinned there, the latest in
|
||||||
|
the registry, and whether the latest still works with the pinned provider. For each
|
||||||
|
module the bundle lists under `terraform.modules.watch`, which could not be used
|
||||||
|
when last looked at: whether its latest version now can.
|
||||||
|
|
||||||
|
It reads the public registry and changes nothing. Raising a pinned version is a
|
||||||
|
change to the Skill's example, which `tests/test_iac_modules.py` then validates.
|
||||||
|
|
||||||
|
Usage: .venv/bin/python scripts/check-terraform-modules.py [provider]
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
|
from app.adk.runtime import ToolResult
|
||||||
|
from app.providers import load_provider
|
||||||
|
from app.tools.modules import ModuleLookup, admits, module_calls
|
||||||
|
|
||||||
|
_HCL = re.compile(r"^```hcl\n(.*?)^```", re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
|
def _blocked(part: dict, pinned: dict[str, str]) -> list[str]:
|
||||||
|
"""The provider requirements of a module that the pinned versions do not meet."""
|
||||||
|
return [
|
||||||
|
f"{need.get('name')} {need.get('version')}"
|
||||||
|
for need in part.get("provider_dependencies") or []
|
||||||
|
if need.get("name") in pinned
|
||||||
|
and need.get("version")
|
||||||
|
and not admits(need["version"], pinned[need["name"]])
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def main(provider: str) -> int:
|
||||||
|
bundle = load_provider(provider)
|
||||||
|
if not bundle.terraform_modules_skill:
|
||||||
|
print(f"The {provider} bundle names no modules Skill.")
|
||||||
|
return 0
|
||||||
|
pinned = {name: pin["version"] for name, pin in bundle.terraform_providers.items()}
|
||||||
|
lookup = ModuleLookup(namespaces=bundle.terraform_module_namespaces, pinned=pinned)
|
||||||
|
skill = bundle.skills[bundle.terraform_modules_skill].path
|
||||||
|
|
||||||
|
used: dict[str, set[str]] = {}
|
||||||
|
for reference in sorted((skill / "references").glob("*.md")):
|
||||||
|
code = "\n".join(_HCL.findall(reference.read_text(encoding="utf-8")))
|
||||||
|
for call in module_calls({"main.tf": code}):
|
||||||
|
used.setdefault(call.source.split("//")[0], set()).add(call.version)
|
||||||
|
|
||||||
|
stale = 0
|
||||||
|
print(f"Pinned providers: {pinned}\n\nModules the Skill uses:")
|
||||||
|
for module, versions in sorted(used.items()):
|
||||||
|
data = await lookup._fetch(module, "")
|
||||||
|
if isinstance(data, ToolResult):
|
||||||
|
print(f" {module}: {data.message}")
|
||||||
|
continue
|
||||||
|
latest = str(data.get("version", "?"))
|
||||||
|
blocked = _blocked(data.get("root") or {}, pinned)
|
||||||
|
note = "up to date" if versions == {latest} else f"latest is {latest}"
|
||||||
|
if versions != {latest}:
|
||||||
|
stale += 1
|
||||||
|
if blocked:
|
||||||
|
note += f"; the latest needs {', '.join(blocked)}, so stay on the pin"
|
||||||
|
print(f" {module} {', '.join(sorted(versions))}: {note}")
|
||||||
|
|
||||||
|
print("\nModules that could not be used when last looked at:")
|
||||||
|
usable = 0
|
||||||
|
for name in bundle.terraform_modules_watch:
|
||||||
|
data = await lookup._fetch(name, "")
|
||||||
|
if isinstance(data, ToolResult):
|
||||||
|
print(f" {name}: {data.message}")
|
||||||
|
continue
|
||||||
|
blocked = _blocked(data.get("root") or {}, pinned)
|
||||||
|
if blocked:
|
||||||
|
print(f" {name} {data.get('version')}: still needs {', '.join(blocked)}")
|
||||||
|
else:
|
||||||
|
usable += 1
|
||||||
|
print(
|
||||||
|
f" {name} {data.get('version')}: NOW USABLE with the pinned provider"
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
f"\n{stale} pinned module(s) have a newer version; {usable} watched "
|
||||||
|
"module(s) can now be used."
|
||||||
|
)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(asyncio.run(main(sys.argv[1] if len(sys.argv) > 1 else "gcp")))
|
||||||
@@ -44,6 +44,7 @@ Not usable with this provider version, so write these directly: the load balance
|
|||||||
- Keep `terraform/versions.tf` from the patterns Skill unchanged. A module's own provider requirements are met by it.
|
- Keep `terraform/versions.tf` from the patterns Skill unchanged. A module's own provider requirements are met by it.
|
||||||
- Pass every environment-specific value from a variable, as for resources.
|
- Pass every environment-specific value from a variable, as for resources.
|
||||||
- Before using an input the reference does not show, call `terraform_module` with `find` set to its name.
|
- Before using an input the reference does not show, call `terraform_module` with `find` set to its name.
|
||||||
|
- Set every input a Check depends on, even when the module's default already gives that value. A Check is verified from a value written in the code; a default left unset can only be argued from the module's documentation, and changes when the module does.
|
||||||
- A module takes names, not always ids: read which one an input wants. Pass another module's output where one depends on the other, so Terraform orders them.
|
- A module takes names, not always ids: read which one an input wants. Pass another module's output where one depends on the other, so Terraform orders them.
|
||||||
|
|
||||||
## Checks on an Element a module creates
|
## Checks on an Element a module creates
|
||||||
@@ -52,4 +53,4 @@ A Check is still about the resource: "the instance has no public IP address". Th
|
|||||||
|
|
||||||
- In `implementation.json`, `address` names the module and the input: `module.database.ip_configuration.ipv4_enabled`.
|
- In `implementation.json`, `address` names the module and the input: `module.database.ip_configuration.ipv4_enabled`.
|
||||||
- When no input sets what a Check needs, the module does not fit that Element. Write its resources directly; do not mark the Check unimplementable, since the resource type does have the setting.
|
- When no input sets what a Check needs, the module does not fit that Element. Write its resources directly; do not mark the Check unimplementable, since the resource type does have the setting.
|
||||||
- When validating, read the input's value in the code and confirm with `terraform_module` what that input sets. An input left at its default is judged by the default the lookup shows. A Check is not verifiable only when neither the code nor the module's documentation shows what the resource will get.
|
- When validating, read the input's value in the code and confirm with `terraform_module` what that input sets. An input left at its default is judged by the default the lookup shows, and the verdict says the value is a default and not set in the code. A Check is not verifiable only when neither the code nor the module's documentation shows what the resource will get.
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ Published 2026-10-10, from lesson proposal 06.
|
|||||||
|
|
||||||
## L-07: Verify location constraints
|
## L-07: Verify location constraints
|
||||||
|
|
||||||
**Rule.** When a requirement specifies where resources must be provisioned, such as a designated region, multi-zone placement, or a low-carbon location, create a Check for the `region` or `location` argument on every applicable Element.
|
**Rule.** When a requirement specifies where resources must be provisioned, such as a designated region or multi-zone placement, create a Check for the `region` or `location` argument on every applicable Element, naming the region the design uses. Do not write a Check about a property of the region that code cannot show, such as its carbon rating.
|
||||||
|
|
||||||
**Why.** Validation frequently catches missing location constraints. Without this Check, resources may be provisioned in default regions, violating compliance or sustainability requirements.
|
**Why.** Validation frequently catches missing location constraints. Without this Check, resources may be provisioned in default regions, violating location requirements. A Check about a region's carbon rating cannot be verified from code and sends the design back.
|
||||||
|
|
||||||
Published 2026-10-10, from lesson proposal 07.
|
Published 2026-10-10, from lesson proposal 07.
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ A list. Number functional requirements `FR-1`, `FR-2` and non-functional ones `N
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Every non-functional requirement lists its `conditions`: one entry for each separate thing that must be true for it to be met and that infrastructure configuration can show. What it asks for that configuration cannot show goes under `outside_code`: an outcome measured in operation, behaviour of the application's own code, or a process people follow. A requirement has at least one entry between the two; one that is entirely outside code has `"conditions": []`. Write each so it can be checked on its own, and so that together they say everything the text says. The Target architecture needs a Check for each one.
|
Every non-functional requirement lists its `conditions`: one entry for each separate thing that must be true for it to be met and that infrastructure configuration can show. What it asks for that configuration cannot show goes under `outside_code`: an outcome measured in operation, behaviour of the application's own code, a process people follow, or a property of a region or product that only its provider publishes, such as a region's carbon rating or a product's service level. For those, the condition is the choice that configuration can show: "every resource is in the one agreed region" is a condition, and "that region has a high carbon-free energy score" is `outside_code`. A requirement has at least one entry between the two; one that is entirely outside code has `"conditions": []`. Write each so it can be checked on its own, and so that together they say everything the text says. The Target architecture needs a Check for each one.
|
||||||
|
|
||||||
`kind` is `functional` or `non_functional`. Write one requirement per entry, so each can be checked on its own.
|
`kind` is `functional` or `non_functional`. Write one requirement per entry, so each can be checked on its own.
|
||||||
|
|
||||||
|
|||||||
@@ -203,3 +203,12 @@ def test_the_gcp_bundle_names_its_modules_skill_for_the_roles_that_run_terraform
|
|||||||
assert all(
|
assert all(
|
||||||
bundle.terraform_modules_skill not in role.skills for role in roles.values()
|
bundle.terraform_modules_skill not in role.skills for role in roles.values()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_bundle_lists_modules_to_watch_from_its_approved_namespaces():
|
||||||
|
bundle = load_provider("gcp")
|
||||||
|
|
||||||
|
assert bundle.terraform_modules_watch
|
||||||
|
for module in bundle.terraform_modules_watch:
|
||||||
|
namespace, _, provider = module.split("/")
|
||||||
|
assert namespace in bundle.terraform_module_namespaces and provider == "google"
|
||||||
|
|||||||
Reference in New Issue
Block a user