Skip to content

Migrate PolicyGroup to infer - #837

Draft
iwahbe wants to merge 1 commit into
mainfrom
iwahbe/migrate-policy-group
Draft

Migrate PolicyGroup to infer#837
iwahbe wants to merge 1 commit into
mainfrom
iwahbe/migrate-policy-group

Conversation

@iwahbe

@iwahbe iwahbe commented May 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Migrates the PolicyGroup resource to the infer framework, replacing
    the legacy gRPC PulumiServicePolicyGroupResource implementation.
  • Removes the manual PolicyGroup, PolicyGroupStackReference,
    PolicyGroupPolicyPackReference, and PolicyGroupPolicyPackReferenceInput
    schema blocks from manual-schema.json; infer regenerates them from the
    Go struct definitions.
  • Preserves the legacy resource semantics: order-independent diff on
    stacks/accounts/policyPacks, child-account skip-on-remove when the parent
    is still in the input set, version-strip in Check so legacy programs
    that still set the server-derived field upgrade cleanly, and
    replaceOnChanges for name / organizationName / entityType / mode.
  • Update sends each batch op in its own request to dodge the Cloud's
    reorder/upsert-by-name behavior, and recovers the real state for the
    checkpoint if a mid-batch op fails; policy-pack equality compares config,
    treating a nil and an empty config map as equal.

Notes

  • The generated SDK type for the policy pack's version field changes from
    number to integer, matching the API client's int field. This is a
    minor SDK-shape change but more accurate.
  • Existing tests for diff order-independence, policy-pack equality (including
    config), the parent-account child-skip rule, and the version-strip
    behavior cover the new resource shape.

Test plan

  • make provider
  • make build_sdks
  • go test ./... in provider/pkg
  • make lint (provider + sdk + examples)
  • CI integration tests

@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Does the PR have any schema changes?

Found 1 breaking change:

Types

  • 🟡 "pulumiservice:index:PolicyGroupPolicyPackReference": properties: "version" type changed from "number" to "integer"
    No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.33333% with 186 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.59%. Comparing base (6bafee8) to head (33cec2c).

Files with missing lines Patch % Lines
provider/pkg/resources/policy_group.go 48.18% 176 Missing and 10 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #837      +/-   ##
==========================================
- Coverage   52.18%   50.59%   -1.59%     
==========================================
  Files          82       82              
  Lines        9598     9514      -84     
==========================================
- Hits         5009     4814     -195     
- Misses       4117     4240     +123     
+ Partials      472      460      -12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@iwahbe

iwahbe commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

Metabase shows that an __inputs migration isn't necessary.

Replaces the manual `PulumiServicePolicyGroupResource` implementation
with an infer-based resource. The Cloud API contract is unchanged:
entityType, mode, name, and organizationName still force replacement;
stacks, accounts, and policyPacks update in-place via the existing
batch endpoint; child accounts are still skipped on remove when their
parent is still in the input set.

Update sends each batch op in its own request to dodge the Cloud's
reorder/upsert-by-name behavior, recovering real state for the
checkpoint if a mid-batch op fails. Policy-pack equality compares
config, treating a nil and an empty config map as equal.

Removes the now-unused schema blocks (`PolicyGroup`,
`PolicyGroupStackReference`, `PolicyGroupPolicyPackReference`,
`PolicyGroupPolicyPackReferenceInput`) from `manual-schema.json`; the
infer framework regenerates them from the Go struct definitions. The
generated SDK `version` field is now typed as `integer` rather than
`number`, matching the API client's `int` type.
@iwahbe
iwahbe force-pushed the iwahbe/migrate-policy-group branch from 5b4f16c to 33cec2c Compare June 9, 2026 15:59
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