Skip to content

resource/pingone_population: Add export support - #135

Closed
samir-gandhi wants to merge 4 commits into
mainfrom
polaris/GH-81-pingone-population-export-support
Closed

resource/pingone_population: Add export support#135
samir-gandhi wants to merge 4 commits into
mainfrom
polaris/GH-81-pingone-population-export-support

Conversation

@samir-gandhi

@samir-gandhi samir-gandhi commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements Terraform export support for pingone_population per issue resource/pingone_population: add export support #81, following the schema-driven pattern: one YAML definition (definitions/pingone/sso/population.yaml) and one Go handler (internal/platform/pingone/resource_population.go) — no edits to existing resource files.
  • Uses the github.com/patrickcping/pingone-go-sdk-v2/management SDK (via Client.management(ctx)), following the list-then-paginate/get pattern documented in the new-resource-pingone skill for PopulationsApi.ReadAllPopulations/ReadOnePopulation.
  • password_policy.id and theme.id nested attributes declare references_type pointing at pingone_password_policy and pingone_branding_theme respectively — neither resource type is implemented yet in this repo, so both degrade gracefully to Terraform variable fallbacks (var.pingone_password_policy_id, var.pingone_branding_theme_id) per the existing reference-resolution fallback behavior in orchestrator.go. Resolution will auto-promote to a resource reference once those resource types are added, with zero changes needed to population.yaml.
  • contributing/RESOURCE_COVERAGE.md flipped pingone_population to ✅.
  • Changelog entry added at .changelog/pr-135.txt.
  • Updated two pre-existing test files (internal/platform/pingone/dispatch_test.go, internal/schema/integration_test.go) whose assertions hardcode the total registered/loaded resource count — these needed a +1 bump to account for the new registration, per this repo's existing pattern for adding a resource.

Dependency: Base SDK integration (PR #132) is a dependency — this PR should not be merged before #132.

Closes #81

Test plan

  • go run ./tools/validate-definitions definitions/ — passes, 9/9 definitions including pingone_population (10 attributes)
  • go build ./... / go vet ./... / go fmt ./... — clean
  • go test ./internal/... -v -count=1 — all packages pass, including new table-driven tests in resource_population_test.go (list success/empty/no-embedded/API-error/unconfigured-client, get success/not-found/empty-id/unconfigured-client)
  • Live export against a real PingOne environment: ./pingcli-terraformer export --out /tmp/export-test-population --output-format hcl --include-imports — found and exported 2 populations, correct environment_id = var.pingone_environment_id, theme.id correctly fell back to var.pingone_branding_theme_id (no raw UUIDs in output), import blocks generated correctly
  • make regression-local — PASS, only acceptable additions (new pingone_population.tf file, new pingone_branding_theme_id variable) vs. main; no deletions or replacements in existing resources

🤖 Generated with Claude Code

samir-gandhi and others added 4 commits July 24, 2026 15:34
…sources

pingone-go-client only covers DaVinci, Environments, Connectors, and
ConfigurationManagement APIs, so the ~92 open Platform/SSO/Authorize/MFA/
Protect/Verify export-support issues cannot be implemented against it.
Add patrickcping/pingone-go-sdk-v2/management (the SDK terraform-provider-
pingone itself uses) as a second client on Client, built lazily since it
performs an OAuth exchange at construction time rather than on first
request.
The go:embed directive listed pingone/base and pingone/davinci explicitly,
so every new resource category (sso, platform, mfa, ...) would require
editing this file — violating the "new resource requires zero edits to
existing files" invariant. A single pingone/*/*.yaml wildcard covers any
category subdirectory automatically.
Adds the pingone_population YAML definition and Go handler using the
management SDK's list-then-paginate/get pattern, per issue #81. Both
password_policy.id and theme.id nested references degrade gracefully
to Terraform variable fallbacks since pingone_password_policy and
pingone_branding_theme are not yet exported by this tool; resolution
auto-promotes once those resource types land, with no changes needed
here.

Updates dispatch_test.go and schema integration_test.go resource-count
assertions to account for the new registered type, and flips the
pingone_population row in RESOURCE_COVERAGE.md to supported.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Regression Test Results

Matrix Entry Status Breaking Acceptable

✅ No regressions detected

All export configurations produced compatible output.


Generated by regression workflow • View run

@github-actions

Copy link
Copy Markdown

Regression Test Results

Matrix Entry Status Breaking Acceptable
default-hcl ✅ PASS 0 5
default-tfjson ✅ PASS 0 5
hcl-include-all ✅ PASS 0 7
hcl-skip-deps ✅ PASS 0 1
tfjson-skip-deps ✅ PASS 0 1

✅ No regressions detected

All export configurations produced compatible output.


Generated by regression workflow • View run

@samir-gandhi

Copy link
Copy Markdown
Contributor Author

Superseded by the pingone-core-resources branch — this PR's commits now live directly on that branch, which is being used as the integration target for the ongoing PingOne resource coverage pilot (tracked in #119) instead of main. Future resource PRs in this pilot target pingone-core-resources directly. Closing without merging to main.

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.

resource/pingone_population: add export support

1 participant