# Platform IaC

What Platform IaC is, which Vulnesis configuration you can keep as code, and how documents are applied from the CLI, Terraform and a repository.

Platform IaC is for teams that want their Vulnesis settings, such as quality gates, firewall policy, members and connections, reviewed in pull requests and reproducible across organisations instead of clicked into the Resolve Platform. Use it to manage how Vulnesis is configured. To scan your own Terraform or Kubernetes code for misconfigurations, use [IaC scanning](/iac-scanning.md).

Platform IaC is Vulnesis configuration written as YAML documents, kept in a repository and checked like code. Every document has the same shape: `apiVersion: vulnetix.com/v1`, a `kind`, `metadata` and a `spec`. Each kind has a published JSON Schema, a page here with its fields and samples, and, where the engine stores it, a Terraform resource.

```yaml
apiVersion: vulnetix.com/v1
kind: QualityGate
metadata:
  name: default
spec:
  severity: high
  blockMalware: true
```

## What exists

| Piece | What it does | Page |
|---|---|---|
| Kinds | Every kind in `config-schemas` (the catalogue says which release), from the quality gate and jail policy to the organization's members, the Software Factory, TEA, SIEM and cloud connections. Each page has the fields, rules, Minimal and Advanced samples in YAML, HCL and CLI, and how apply treats it. | [Kind catalogue](/platform-iac/kinds/catalogue.md) |
| Config engine | The server side that plans, applies and exports every kind, records who manages each object, and reports status. All kinds are served except `LicensePolicy` and `LicenseExceptions`, which are validate only. | [Engine](/platform-iac/reference/engine.md), [Config API](/platform-iac/reference/config-api.md) |
| CLI | `vulnetix config validate`, `kinds` and `schema` work offline; `plan`, `apply` and `export` use the engine. | [Validate](/platform-iac/cli/validate.md), [Plan](/platform-iac/cli/plan.md), [Apply](/platform-iac/cli/apply.md), [Export](/platform-iac/cli/export.md) |
| CEL | A `when` or `selector` expression on jail rules, risk rules, suppressions, package list entries, AI guardrails and detection rule feeds. | [CEL rule expressions](/platform-iac/reference/cel.md) |
| Terraform and OpenTofu | The `vulnetix/resolve` provider, one resource per kind, published on the Terraform and OpenTofu registries, and two AWS modules on the Terraform registry. | [Terraform and OpenTofu](/platform-iac/terraform.md) |
| GitHub Actions | Plan on pull requests, apply on the default branch. | [config-plan](/platform-iac/github-actions/config-plan.md), [config-apply](/platform-iac/github-actions/config-apply.md) |
| Schemas | Signed JSON Schemas, with pinned and `latest` URLs. | [Schema releases](/platform-iac/schemas/releases.md) |

> [!CAREFUL] Validating is not applying
> `vulnetix config validate` checks documents and changes nothing in your organization. `vulnetix config plan` shows what applying would change, and `vulnetix config apply` changes it. A CLI release embeds one release of the schemas and refuses a kind added after it as unknown, so check the CLI line on a kind's page; the [roadmap](/platform-iac/planned/roadmap.md) lists the gaps.

## Three ways to apply a document

| Way | Use it when | Credential |
|---|---|---|
| `vulnetix config apply` | You keep documents in `.vulnetix/config` or pipe them in; a person or CI applies them. | The ApiKey of a `developer` or `owner` service account, or an owner login |
| The `config-apply` workflow node and the GitHub Actions | A config repository should manage the tenant on every push to its default branch, with an approval. | The same token |
| Terraform or OpenTofu | The rest of your infrastructure is already Terraform. | The same token |

All three go through the same engine, so a document gives the same result in each, and each records its own manager. `--prune` deletes only objects its own manager owns.

## Find the page for your task

| I want to | Read |
|---|---|
| See every kind | [Kind catalogue](/platform-iac/kinds/catalogue.md) |
| Write a quality gate document and check it in CI | [Quickstart](/platform-iac/get-started/quickstart.md) |
| Know what `metadata.name` and `metadata.org` mean | [Documents](/platform-iac/get-started/documents.md) |
| Write a `when` condition | [CEL rule expressions](/platform-iac/reference/cel.md) |
| Manage settings with Terraform | [Terraform and OpenTofu](/platform-iac/terraform.md) |
| Pull VEX documents in as suppressions | [VEX documents as suppression rules](/platform-iac/guides/vex-sources.md) |
| Get completion and errors in my editor | [Editor setup](/platform-iac/schemas/editors.md) |
| Check a schema file was published by Vulnesis | [Verify a release](/platform-iac/schemas/verify.md) |
| Know whether a schema update can break my files | [Compatibility](/platform-iac/schemas/compatibility.md) |
| Set the org quality gate from a script | [Imperative commands](/platform-iac/cli/imperative-commands.md) |
| Keep AI firewall policy in a repository | [AiFirewallPolicy](/platform-iac/kinds/ai-firewall-policy.md) |
| See what is not available yet | [Roadmap](/platform-iac/planned/roadmap.md) |

## Platform IaC in each product

Every other product segment ends with a short Platform IaC section that links the kinds of that product.
