-
Notifications
You must be signed in to change notification settings - Fork 1
docs: update Terraform reference: custom_attestation_type summary attribute #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,6 +37,7 @@ resource "kosli_custom_attestation_type" "security_scan" { | |||||
| medium_vulnerabilities = { type = "integer" } | ||||||
| scan_date = { type = "string" } | ||||||
| scanner_version = { type = "string" } | ||||||
| report_url = { type = "string" } | ||||||
| } | ||||||
| required = ["critical_vulnerabilities", "high_vulnerabilities", "scan_date"] | ||||||
| }) | ||||||
|
|
@@ -45,6 +46,15 @@ resource "kosli_custom_attestation_type" "security_scan" { | |||||
| ".critical_vulnerabilities == 0", | ||||||
| ".high_vulnerabilities < 5" | ||||||
| ] | ||||||
|
|
||||||
| # Ordered, labelled values shown on the attestation detail page in Kosli. | ||||||
|
mbevc1 marked this conversation as resolved.
|
||||||
| # A value that is a valid URL renders as a clickable link. | ||||||
| summary = jsonencode([ | ||||||
| { name = "Critical", expression = ".critical_vulnerabilities" }, | ||||||
| { name = "High", expression = ".high_vulnerabilities" }, | ||||||
| { name = "Scanner", expression = ".scanner_version" }, | ||||||
| { name = "Report", expression = ".report_url" }, | ||||||
| ]) | ||||||
| } | ||||||
|
|
||||||
| # Code coverage attestation type | ||||||
|
|
@@ -77,6 +87,21 @@ resource "kosli_custom_attestation_type" "code_coverage" { | |||||
| ] | ||||||
| } | ||||||
|
|
||||||
| # Attestation type whose schema and summary are kept in standalone JSON files, | ||||||
| # so the same definitions can be shared with other tooling | ||||||
| resource "kosli_custom_attestation_type" "code_quality" { | ||||||
| name = "code-quality" | ||||||
| description = "Validates code quality metrics" | ||||||
|
|
||||||
| schema = file("${path.module}/schemas/code-quality.json") | ||||||
| summary = file("${path.module}/summaries/code-quality.json") | ||||||
|
|
||||||
| jq_rules = [ | ||||||
| ".line_coverage >= 80", | ||||||
| ".lint_errors == 0" | ||||||
| ] | ||||||
| } | ||||||
|
Comment on lines
+90
to
+103
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improvement — this example points at files whose contents are never shown. A reader can't tell what belongs in Two smaller things: the resource is named Suggest either dropping this example (the |
||||||
|
|
||||||
| # Age verification attestation type with only jq rules (no schema) | ||||||
| resource "kosli_custom_attestation_type" "age_verification" { | ||||||
| name = "age-verification" | ||||||
|
|
@@ -161,3 +186,4 @@ terraform import kosli_custom_attestation_type.security_scan security-scan | |||||
| - `description` (String) Description of the custom attestation type. Explains what this attestation type validates. | ||||||
| - `jq_rules` (List of String) List of jq evaluation rules. Each rule is a jq expression that must evaluate to true for the attestation to be considered compliant. Example: `[".coverage >= 80"]`. If omitted, no evaluation is performed. | ||||||
| - `schema` (String) JSON Schema definition that defines the structure of attestation data. Can be provided inline using heredoc syntax or loaded from a file using `file()`. If omitted, no schema validation is performed. Semantic equality is used for comparison, so formatting differences are ignored. | ||||||
| - `summary` (String) JSON array of ordered, labelled jq expressions rendered as rows on the attestation detail page in Kosli. Each element is an object with a `name` (the row label) and an `expression` (a jq expression evaluated against the attestation data); values that are valid URLs render as links. Can be provided inline using `jsonencode()`/heredoc syntax or loaded from a file using `file()`, so the same JSON can be kept in one place and shared with other tooling. Example: `jsonencode([{ name = "Coverage", expression = ".coverage" }])`. If omitted, the attestation detail page falls back to showing the jq evaluation results as a pass/fail checklist; removing it from a type that had one clears the summary. Semantic JSON equality is used when reading the value back from Kosli, so your formatting is preserved rather than being rewritten to the API's compact form. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improvement — this entry is doing too much work. It's six sentences and ~3× longer than any neighbouring bullet, and it's the only place several behaviors are documented (URL rendering, the fallback, Suggest adding a
Suggested change
|
||||||
Uh oh!
There was an error while loading. Please reload this page.