resource/pingone_resource: add export support - #136
Closed
samir-gandhi wants to merge 4 commits into
Closed
Conversation
…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>
Regression Test Results
✅ No regressions detectedAll export configurations produced compatible output. Generated by regression workflow • View run |
Regression Test Results
✅ No regressions detectedAll export configurations produced compatible output. Generated by regression workflow • View run |
Contributor
Author
|
Superseded by the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pingone_resource(PingOne OAuth 2.0 custom resources), closing resource/pingone_resource: add export support #84.definitions/pingone/sso/resource.yaml(creates thessocategory directory).internal/platform/pingone/resource_resource.go, using thepingone-go-sdk-v2/managementSDK'sResourcesApi(ReadAllResourcesiterator +ReadOneResource).OPENID_CONNECT,PINGONE_API) that the API returns alongside admin-created ones. Onlytype: CUSTOMresources are manageable via thepingone_resourceTerraform resource (per the provider schema and docs), solistResourcesfilters the list down toCUSTOMonly — mirroring the existing precedent oflistConnectorInstancesskipping the built-in User Pool connector._embedded.resourcescollection in this SDK is a discriminated union (EntityArrayEmbeddedResourcesInner{Resource, ResourceApplicationResource}); the handler unwraps viaGetActualInstance()and skips theResourceApplicationResourcevariant, which represents a different embedded shape, not a top-level resource.contributing/RESOURCE_COVERAGE.md: flipped thepingone_resourcerow to ✅..changelog/.Dependency: this PR builds on PR #132 (
core: Add pingone-go-sdk-v2/management SDK for non-DaVinci PingOne resources), which added themanagementSDK client and theClient.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 newpingone_resourcedefinition (10 attributes)go build ./...go vet ./...go fmt ./...go test ./internal/... -v -count=1— all packages pass, including new table-driven tests ininternal/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.CUSTOMresource via the raw Resources API, ran./pingcli-terraformer export --out /tmp/export-test-resource --output-format hcl --include-imports, verified the generatedpingone_resource.tf— all attributes present and correctly typed,environment_idextracted asvar.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.