fixed multile issues
Some checks failed
validation / verify (push) Failing after 8s

This commit is contained in:
2026-10-07 17:33:36 +01:00
parent 4c4d44ef87
commit 5bb22d984e
76 changed files with 5799 additions and 179 deletions

View File

@@ -2,31 +2,35 @@
name: iac-validation
description: >-
Checks Terraform infrastructure-as-code without provisioning anything, using
the local terraform_fmt, terraform_validate and terraform_plan tools. Use when
writing deployment guidance or validating it before deployment.
the local terraform_fmt, terraform_validate, terraform_plan and
terraform_schema tools. Use when writing deployment guidance or validating it
before deployment.
metadata:
scope: deployment-guidance validation
---
# IaC validation
Every check runs on a scratch copy of the files you pass. Nothing is applied, and no state is written.
Every check runs on a scratch copy of your Terraform files. Nothing is applied, and no state is written.
The files are your working copy: the files you wrote with `write_file`, or, when you are validating, the files that were submitted. Pass the tools no files.
## Tools
- `terraform_fmt(files)`: returns the files formatting changed. Replace your copies with the returned content.
- `terraform_validate(files)`: runs `init -backend=false` and `validate` offline. It reports syntax errors, unknown references, missing variables and invalid arguments.
- `terraform_plan(files, variables)`: previews the changes against the live cloud environment. It reads live state, so the first call may pause for the user's permission. Pass every variable the configuration requires.
- `terraform_fmt()`: formats your working copy in place and names the files it changed.
- `terraform_validate()`: runs `init -backend=false` and `validate` offline. It reports syntax errors, unknown references, missing variables and invalid arguments.
- `terraform_plan(variables)`: previews the changes against the live cloud environment. It reads live state, so the first call may pause for the user's permission. Pass every variable the configuration requires.
- `terraform_schema(resource_type, block, find)`: what a resource type accepts, from the provider's own schema. With `resource_type` alone it lists the top-level arguments and outlines every block. With `block`, such as `template.containers`, it gives that block's arguments in full. With `find`, it says where an argument or block of that name sits, or that the resource type has none.
## When writing deployment guidance
1. Run `terraform_fmt`, then `terraform_validate`, on the complete set of files you will attach.
2. Fix every error and run both again, until `terraform_validate` passes.
3. Attach the formatted files.
1. Run `terraform_fmt`, then `terraform_validate`.
2. Fix each error with `edit_file`, changing only the lines concerned, and run `terraform_validate` again until it passes.
3. On "An argument named X is not expected here" or "Unsupported block type", call `terraform_schema` with `find` set to the name. It is either in a different block, which the reply names, or it does not exist on that resource type. Never move it around by trial.
## When validating deployment guidance
1. Run `terraform_validate` on the attached files, and report its verdict and output.
1. Run `terraform_validate`, and report its verdict and output.
2. When permission to read the live environment is granted, run `terraform_plan` with the variable values from the requirements, or clearly marked placeholders. Summarise the resources to add, change and destroy, and flag any destroy or replace.
3. When a check can't run (a missing CLI, a refused permission or a provider download failure), give the user the exact commands to run themselves:
@@ -40,4 +44,6 @@ Every check runs on a scratch copy of the files you pass. Nothing is applied, an
Give a verdict on every Check in the Target architecture and attach them as `verdicts.json`, in the format the requirements-chain Skill gives. The dry-run's result goes in its `dry_run` entry: `pass` when `terraform_validate` passes, `fail` with the error when it does not, and `not_run` when the tool could not run.
A Check fails when the code could meet it and does not. When `terraform_schema` shows the resource type has no such setting, no code could meet it: the verdict is `not_verifiable`, with the schema's answer as evidence.
Never suggest `terraform apply` as part of validation.