feat: add project_id support to ory_json_web_key_set resource#132
feat: add project_id support to ory_json_web_key_set resource#132
Conversation
There was a problem hiding this comment.
Pull request overview
Adds project_id support to the ory_json_web_key_set Terraform resource by resolving a project slug via the console API and using a project-scoped client, enabling project-id-based workflows and composite import.
Changes:
- Added console-backed
project_id -> slugresolution with caching and a helper to build a project-scoped client. - Extended
ory_json_web_key_setschema/CRUD/import to acceptproject_idand supportproject_id/set_idimport. - Updated acceptance tests, docs, templates, and examples to demonstrate
project_idusage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/resources/json_web_key_set.md.tmpl | Documents immutability + composite import format including project_id. |
| internal/resources/jwk/testdata/basic.tf.tmpl | Acceptance test config now sets project_id. |
| internal/resources/jwk/resource_test.go | Acceptance test validates project_id and uses composite import ID. |
| internal/resources/jwk/resource.go | Adds project_id attribute, resolves per-project client, updates import parsing. |
| internal/client/client.go | Adds slug-resolution + caching and ProjectClientForProject. |
| examples/resources/ory_json_web_key_set/resource.tf | Example updated to show provider-based and explicit project_id usage. |
| docs/resources/json_web_key_set.md | Generated docs updated for project_id + composite import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
7097630 to
28c0b6a
Compare
There was a problem hiding this comment.
Pull request overview
Adds resource-level project_id support for ory_json_web_key_set by resolving project slug via the console API and using a project-scoped client, improving usability in project_id-based workflows.
Changes:
- Add
project_idattribute to the JWK Set resource schema, wiring CRUD to resolve a project-scoped client. - Add client helpers to resolve
project_id -> slugvia console API with in-run caching. - Update docs/examples/tests to demonstrate
project_idusage and composite import (project_id/set_id).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/resources/json_web_key_set.md.tmpl | Updates generated docs for immutability note and composite import format. |
| internal/resources/jwk/testdata/basic.tf.tmpl | Updates acceptance test config template to set project_id. |
| internal/resources/jwk/resource_test.go | Updates acceptance test to pass project_id and import using composite ID. |
| internal/resources/jwk/resource.go | Adds project_id attribute, project client resolution helper, and composite import parsing. |
| internal/client/client.go | Adds console-based slug resolution + cached project-scoped client creation. |
| examples/resources/ory_json_web_key_set/resource.tf | Updates example usage to show provider-derived vs explicit project_id. |
| docs/resources/json_web_key_set.md | Updates rendered docs for immutability note, examples, import, and project_id attribute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
28c0b6a to
6fcbd1b
Compare
There was a problem hiding this comment.
Pull request overview
Adds resource-level project_id support for ory_json_web_key_set, enabling project-id-based workflows by resolving a project-scoped client and supporting composite import IDs.
Changes:
- Introduces
project_idon the JWK resource (schema + CRUD + import parsing). - Adds client helpers to resolve project slug from project ID (with per-run caching) and to build project-scoped clients.
- Updates docs/examples and acceptance test config to demonstrate/import using
project_id.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/resources/json_web_key_set.md.tmpl | Updates generated docs template to include project_id immutability + composite import format. |
| internal/resources/jwk/testdata/basic.tf.tmpl | Updates acceptance test template to set project_id. |
| internal/resources/jwk/resource_test.go | Updates acceptance test to pass ORY_PROJECT_ID and import via composite ID. |
| internal/resources/jwk/resource.go | Adds project_id attribute, routes CRUD through project-scoped client, and supports project_id/set_id import IDs. |
| internal/client/client.go | Adds slug resolution (cached) and project-scoped client creation for a given project_id. |
| examples/resources/ory_json_web_key_set/resource.tf | Updates example to show provider-based project context and explicit project_id. |
| docs/resources/json_web_key_set.md | Updates docs with project_id and composite import format + attribute listing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
The JWK resource previously required project_slug and project_api_key on the provider, with no way to specify project_id at the resource level. This made it impossible to use with project_id-based workflows. Changes: - Add optional project_id attribute to ory_json_web_key_set (falls back to provider's project_id when not set) - Add ResolveProjectSlug and ProjectClientForProject methods to the client for resolving project_id to slug via the console API - Cache resolved slugs to avoid redundant API calls within a run - Extract shared resolve logic into projectClient helper - Validate import ID format when slash is present - Preserve backward compatibility: fall back to provider's default client when no project_id is configured anywhere - Support composite import format: project_id/set_id - Update acceptance tests, examples, and documentation
6fcbd1b to
d92d57f
Compare
Description
Add
project_idsupport to theory_json_web_key_setresource. The resource previously requiredproject_slugandproject_api_keyon the provider with no way to specifyproject_idat the resource level, making it unusable forproject_id-based workflows.The resource now accepts an optional
project_idattribute that auto-resolves the project slug via the console API, eliminating the need to manually configureproject_slugon the provider for JWK operations.Changes
Client (
internal/client/client.go):ResolveProjectSlug(ctx, projectID)-- resolves project ID to slug via console API, with caching viasync.Mapto avoid redundant API calls within a Terraform runProjectClientForProject(ctx, projectID)-- returns a project-scoped client for a given project IDResource (
internal/resources/jwk/resource.go):project_idattribute (optional, computed, requires replace)project_idproject_idis set (either on the resource or provider) before any operationproject_id/set_idand plainset_idformatsTests, docs, examples updated to demonstrate
project_idusage.Related Issues
Fixes #120
Type of Change
Checklist
make test)make format)Testing
make test-short-- all pass)TestAccJWKResource_basicpasses with create, read, and composite import)Screenshots/Output
Security scans (
make sec && make sec-trivy) -- 0 issues, no leaks."