Skip to content

Release 0.3.34: Azure policy example fix + start_datecode fix + Go/grpc security bumps - #147

Merged
bshutterkion merged 10 commits into
mainfrom
fix/azure-policy-example-policyrule-structure
Apr 16, 2026
Merged

Release 0.3.34: Azure policy example fix + start_datecode fix + Go/grpc security bumps#147
bshutterkion merged 10 commits into
mainfrom
fix/azure-policy-example-policyrule-structure

Conversation

@bshutterkion

@bshutterkion bshutterkion commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bundles four fixes for release 0.3.34:

  1. kion_azure_policy example was broken. A customer copied examples/resources/kion_azure_policy/resource.tf and hit:

    Error: url: .../v3/azure-policy, method: POST, status: 400, body:
    {"message":"The Azure Policy Definition is invalid. Reason: ...
    'Could not find member \'if\' on object of type \'PolicyDefinitionProperties\'...'"}
    

    Root cause: the provider forwards the policy attribute as the properties body of Azure's Policy Definition API, so the rule MUST be wrapped in policyRule. The example used top-level if / then. The top-level Terraform parameters attribute was also misused — re-declaring the parameter schema instead of using the runtime { "paramName": { "value": ... } } form.

    Fix:

    • All four examples now wrap the rule in policyRule and include displayName / mode.
    • Parameter schemas moved inside the policy JSON's own parameters block.
    • Top-level parameters attribute uses the runtime value format.
    • Added a header comment explaining the distinction.
    • docs/resources/azure_policy.md synced.
  2. kion_custom_account start_datecode validation — cherry-picked from Fix start_datecode validation failing for computed values (#143) #145 (now closed). Replaces GetOk() with GetRawConfig() in CustomizeDiff so computed values (e.g. formatdate()) aren't incorrectly rejected. Closes Custom account start_datecode validation fails when using a computed value #143.

  3. Security: grpc-go bump — cherry-picked from fix: update Go and grpc to address security findings #146 (now closed, thanks @enel1221). Bumps google.golang.org/grpc from v1.61.1 to v1.79.3 to address GHSA-p77j-4mvh-x3m3 / CVE-2026-33186.

  4. Security: Go toolchain bump — cherry-picked from fix: update Go and grpc to address security findings #146 (thanks @enel1221). Bumps Go release line from 1.22 to 1.25 with toolchain go1.25.9 to address Go stdlib CVE-2025-68121. CI workflows (release.yml, golangci-lint.yml) pinned to go1.25.9.

Version bumped to 0.3.34 (final release version).

Test plan

  • go build ./... clean
  • go test ./... green
  • make install builds the combined binary at ~/.terraform.d/plugins/github.com/kionsoftware/kion/0.3.34/<os_arch>/
  • Customer validates the corrected kion_azure_policy example against their sandbox (applies without the 400)
  • Regression check: kion_custom_account with start_datecode = formatdate(...) plans and applies
  • Release pipeline (release.yml) produces a clean Grype scan on the artifact

The example in examples/resources/kion_azure_policy/resource.tf produced
a 400 from Azure when customers copied it:

  The Azure Policy Definition is invalid. Reason: ... 'Could not find
  member 'if' on object of type 'PolicyDefinitionProperties''.

The provider sends the `policy` attribute directly as the `properties`
body of the Azure Policy Definition API, so the rule MUST be nested
inside a `policyRule` object. Top-level `if`/`then` in the example was
wrong. Also the example was misusing the top-level Terraform
`parameters` attribute by re-declaring the parameter schema there
instead of using the runtime `{ paramName: { value: ... } }` form.

- Wrap rule in `policyRule` and add `displayName`/`mode` in all four examples
- Move parameter schemas inside the policy JSON's own `parameters` block
- Use runtime value format in the top-level Terraform `parameters` attribute
- Add header comment explaining the distinction
- Sync generated docs/resources/azure_policy.md
- Bump version to 0.3.34-dev
Replace GetOk() with GetRawConfig() in CustomizeDiff validation for
kion_custom_account. GetOk() returns false for unknown/computed values
during the plan phase, causing validation to incorrectly reject
computed references like formatdate().

Bump version to 0.3.34.
@bshutterkion bshutterkion changed the title Fix kion_azure_policy example + start_datecode computed-value validation (0.3.34-dev) Fix kion_azure_policy example + start_datecode computed-value validation Apr 16, 2026
@bshutterkion
bshutterkion requested a review from egramens April 16, 2026 16:16
@bshutterkion bshutterkion changed the title Fix kion_azure_policy example + start_datecode computed-value validation Release 0.3.34: Azure policy example fix + start_datecode fix + Go/grpc security bumps Apr 16, 2026
v1.58 was released before Go 1.25 and its embedded go/types importer
rejected the Go 1.25.9 export-data format ("unsupported version: 2"),
failing the lint job on this PR.

v1.64.8 is the last v1.x release; staying on v1 avoids the config
migration needed for v2.x. Verified locally with `golangci-lint config
verify` (clean) and a full `golangci-lint run` (clean). This also drops
the `errcheck.ignore is deprecated` warning that v1.58 emitted
spuriously against a config that doesn't use that field.
The prebuilt v1.64.8 binary on the golangci-lint releases page is
compiled with Go 1.24, and golangci-lint refuses to lint code whose
target language version (go 1.25 in our go.mod) exceeds the Go version
it was built with.

Switching the action to install-mode: goinstall causes it to
`go install` golangci-lint using the workflow's Go toolchain (1.25.9
per release.yml / golangci-lint.yml), producing a binary that can
handle the Go 1.25 target.
v2 merged the stylecheck (ST*) and gosimple (S*) linters into
staticcheck, so upgrading from v1 exposes ST1003 warnings that were
latent because this repo never enabled the stylecheck linter in v1.
Addressing them preserves a clean lint run rather than papering over
the family with an -ST* exclusion.

- Migrated .golangci.yml to v2 format via `golangci-lint migrate`
  (linters.default, linters.settings, formatters block, exclusions)
- Renamed identifiers per Go style (ID / URL / JSON initialisms):
  - Exported: PackCvValueIntoJsonStr, UnpackCvValueJsonStr,
    OrgUnitId, AppRoleId (all internal-package, JSON tags preserved)
  - Underscored: dataSourceService_control_policyRead
  - Local vars / func params: projectId, accountId, accountCacheId,
    accountTypeId, accountUrl, oldId, newId, oldProjectId, newProjectId
    across resource_account.go, resource_aws_account.go,
    resource_azure_account.go, resource_custom_account.go,
    resource_gcp_account.go
- Simplified redundant type declaration in provider_test.go (QF1011)

No wire-format impact: renamed struct fields retained their existing
`json:"..."` tags.
GitHub Actions flagged actions/checkout@v4, actions/setup-go@v5, and
golangci/golangci-lint-action@v6 as running on Node 20, which will be
forced to Node 24 starting 2026-06-02 and removed 2026-09-16.

- actions/checkout v4 -> v6
- actions/setup-go v5 -> v6
- golangci/golangci-lint-action v6 -> v9

golangci-lint-action v7+ only supports golangci-lint v2, which is why
the preceding commit migrated the config. Pinning to golangci-lint
v2.11.4 (latest). `install-mode: goinstall` and
`--out-format=github-actions` are no longer needed: v2 binaries are
built with a recent Go toolchain, and the v9 action handles GitHub
annotations natively.
@bshutterkion
bshutterkion merged commit 0004125 into main Apr 16, 2026
1 check 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.

Custom account start_datecode validation fails when using a computed value

3 participants