Skip to content

add AZS009: computed-only fields must not set input-only schema attributes - #44

Merged
katbyte merged 1 commit into
mainfrom
kt/azs009-computed-only
Sep 10, 2026
Merged

katbyte merged 1 commit into
mainfrom
kt/azs009-computed-only

Conversation

@katbyte

@katbyte katbyte commented Sep 10, 2026

Copy link
Copy Markdown
Owner

New rule. A computed-only field (Computed: true, no Optional/Required) is filled from the API, so ValidateFunc, MaxItems, Default, ConflictsWith and the rest of the SDK's input-only list do nothing on it. The plugin SDK's InternalValidate already rejects those on the field that says Computed, but not on fields nested inside a computed-only block, not on an element schema's ValidateFunc, and not Optional/Required on nested fields. Those are the cases this catches, plus everything in a typed resource's Attributes(), which azurerm forces Computed at start-up.

-fix deletes the attribute's line, or turns a nested Optional/Required into Computed. On azurerm: 35 reports, all nested or element cases, zero top-level; the fix touches 11 files and the provider builds.

Also moves AZR009's deleteLine into lib/astx as DeleteLine so both rules share it, and carries the same skipp regex fix as #43 so typos passes here.

@katbyte
katbyte merged commit 3c557a0 into main Sep 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant