Skip to content

resource/pingone_resource: add export support - #136

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

resource/pingone_resource: add export support#136
samir-gandhi wants to merge 4 commits into
mainfrom
polaris/GH-84-pingone-resource-export-support

Conversation

@samir-gandhi

Copy link
Copy Markdown
Contributor

Summary

  • Adds Terraform export support for pingone_resource (PingOne OAuth 2.0 custom resources), closing resource/pingone_resource: add export support #84.
  • New YAML definition: definitions/pingone/sso/resource.yaml (creates the sso category directory).
  • New Go handler: internal/platform/pingone/resource_resource.go, using the pingone-go-sdk-v2/management SDK's ResourcesApi (ReadAllResources iterator + ReadOneResource).
  • Every PingOne environment has two built-in resources (OPENID_CONNECT, PINGONE_API) that the API returns alongside admin-created ones. Only type: CUSTOM resources are manageable via the pingone_resource Terraform resource (per the provider schema and docs), so listResources filters the list down to CUSTOM only — mirroring the existing precedent of listConnectorInstances skipping the built-in User Pool connector.
  • The _embedded.resources collection in this SDK is a discriminated union (EntityArrayEmbeddedResourcesInner{Resource, ResourceApplicationResource}); the handler unwraps via GetActualInstance() and skips the ResourceApplicationResource variant, which represents a different embedded shape, not a top-level resource.
  • contributing/RESOURCE_COVERAGE.md: flipped the pingone_resource row to ✅.
  • Changelog entry added under .changelog/.

Dependency: this PR builds on PR #132 (core: Add pingone-go-sdk-v2/management SDK for non-DaVinci PingOne resources), which added the management SDK client and the Client.management(ctx) accessor this handler calls. This PR should not be merged before #132.

Test plan

  • go run ./tools/validate-definitions definitions/ — all 9 definitions pass, including the new pingone_resource definition (10 attributes)
  • go build ./...
  • go vet ./...
  • go fmt ./...
  • go test ./internal/... -v -count=1 — all packages pass, including new table-driven tests in internal/platform/pingone/resource_resource_test.go (TestListResources, TestGetResource, plus management-client-unavailable edge cases). Two pre-existing tests (internal/platform/pingone/dispatch_test.go, internal/schema/integration_test.go) were updated to reflect the new registered resource type / definition count — this is expected bookkeeping when adding a resource, not unrelated changes.
  • Live export against a real PingOne environment: created a temporary CUSTOM resource via the raw Resources API, ran ./pingcli-terraformer export --out /tmp/export-test-resource --output-format hcl --include-imports, verified the generated pingone_resource.tf — all attributes present and correctly typed, environment_id extracted as var.pingone_environment_id, no unresolved raw UUIDs, import block correctly formatted as <environment_id>/<resource_id>. Deleted the temporary resource afterward.
  • make regression-local — PASS. Only acceptable addition: ping-export-module/pingone_resource.tf. No deletions or replacements of previously-exported resources.

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 Terraform export support for pingone_resource (OAuth 2.0 custom
resources) via the management SDK. Built-in resources (OPENID_CONNECT,
PINGONE_API) are filtered out of the list since only CUSTOM resources
are manageable through the pingone_resource Terraform resource.

Closes #84.

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 0
default-tfjson ✅ PASS 0 0
hcl-include-all ✅ PASS 0 0
hcl-skip-deps ✅ PASS 0 0
tfjson-skip-deps ✅ PASS 0 0

✅ 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.

1 participant