feat: add meshstack_api_key managed resource#158
Merged
Conversation
📊 Test Coverage: 71.9%Top uncovered filesCoverage measured across all packages with |
375eaea to
54d2711
Compare
08593f6 to
ac7f33a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new managed Terraform resource meshstack_api_key to the meshStack Terraform provider, including client support for the underlying meshObject API and accompanying docs/tests.
Changes:
- Introduces
meshstack_api_keyresource with CRUD lifecycle and state handling for the sensitivestatus.client_secret. - Extends the Go API client + mock client with
MeshApiKeytypes/client, and adds full permission enums for validation/docs. - Fixes meshObject kind pluralization for
meshApiKey(key → keys) and generates provider docs/examples.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/provider/provider.go | Registers the new meshstack_api_key resource. |
| internal/provider/api_key_resource.go | Implements schema, CRUD, and plan modification logic for secret rotation. |
| internal/provider/api_key_resource_test.go | Adds acceptance/unit-style test coverage for create + update. |
| internal/provider/acctest/testconfig/build_api_key.go | Adds testconfig builder for API key resource configs. |
| internal/clientmock/mock_client.go | Wires the mock API key client into the overall mock client. |
| internal/clientmock/mock_api_key.go | Implements mock CRUD behavior incl. secret only on create/rotation. |
| examples/resources/meshstack_api_key/resource.tf | Adds example HCL for the new resource. |
| docs/resources/api_key.md | Adds generated registry documentation for meshstack_api_key. |
| client/internal/mesh_object_client.go | Adjusts kind pluralization to support meshApiKey. |
| client/client.go | Adds ApiKey client to the main client bundle and constructor. |
| client/client_kind.go | Adds meshApiKey kind constant. |
| client/client_kind_test.go | Validates InferKind matches the new kind constant. |
| client/api_permissions.go | Expands workspace/admin permission enums and adds AllApiKeyPermissions(). |
| client/api_key.go | Adds API key meshObject DTOs and client implementation (preview API). |
a61960a to
5adbf4b
Compare
j0g3sc
approved these changes
May 7, 2026
Collaborator
j0g3sc
left a comment
There was a problem hiding this comment.
minor remarks I trust you to resolve before you merge.
97270e9 to
245a380
Compare
245a380 to
b324d61
Compare
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.
Add a managed Terraform resource
meshstack_api_keyfor managing meshStack API keys.Changes
meshstack_api_keyresource with full CRUD lifecycle usinggeneric.Get/SetpatternMeshApiKeywith metadata/spec/status)status.client_secretis sensitive+computed, stored in state after creationModifyPlanmarksclient_secretunknown whenexpires_atchanges (secret rotation)UseStateForUnknownpreservesclient_secretin state on non-rotating updatesexpires_atis optional — if omitted, the key never expiresapi_permissions.gowith all workspace and admin permission constants