feat(integration): add allow_all_models attribute to control model access#13
Merged
roh26it merged 1 commit intoPortkey-AI:mainfrom Mar 6, 2026
Conversation
…cess
Add an `allow_all_models` boolean attribute to the `portkey_integration`
resource. This controls whether all models are enabled by default for an
integration. Defaults to true to match the existing API behavior.
When set to false, only models explicitly enabled via
`portkey_integration_model_access` resources are available, giving users
fine-grained control over which models can be used through an integration.
The attribute is managed via the separate `/integrations/{slug}/models`
API endpoint since it is not part of the core integration CRUD API.
roh26it
approved these changes
Mar 6, 2026
Contributor
roh26it
left a comment
There was a problem hiding this comment.
Approved ✓
Reviewed all code changes and ran acceptance tests locally. Everything looks good.
Review Summary
Code Quality:
- Build, vet, and format all pass
- Schema follows existing patterns (Optional/Computed/Default)
- Error handling is consistent with other resources
- Efficient implementation - only calls models API when needed
Test Coverage:
TestAccIntegrationResource_allowAllModelsFalse- PASSTestAccIntegrationResource_allowAllModelsUpdate- PASSTestAccIntegrationResource_basic- PASS (includes import verification)- Tests check actual values, not just existence
Implementation Details I Appreciated:
- Partial failure handling: state is set before the models API call so Terraform tracks the resource even if that call fails
- Non-breaking default (
true) matches existing API behavior - Reads from API on each operation for proper drift detection
Nice work on the PR description too - clear problem statement, implementation details, and test plan.
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
Adds an
allow_all_modelsboolean attribute to theportkey_integrationresource, allowing users to control whether all models are enabled by default for an integration.allow_all_models = true, meaning every model for that provider is available. There was no way to restrict model access to only explicitly enabled models viaportkey_integration_model_accessresources.allow_all_modelsAPI field on theportkey_integrationresource. Setting it tofalsemakesportkey_integration_model_accessresources act as an allowlist.Usage
Implementation Details
allow_all_modelsfield is managed via the models endpoint (PUT /integrations/{slug}/models), not the integration CRUD endpoint. The provider makes a separate API call when needed.trueto match existing API behavior (non-breaking change).allow_all_models = false(skips redundant call for default).GetIntegrationModels()for drift detection.Changes
internal/provider/integration_resource.go— Added schema attribute, Create/Read/Update logicinternal/provider/integration_resource_test.go— Added acceptance tests for create-with-false, toggle true↔false, default behavior assertiondocs/resources/integration.md— Updated with new attribute docs and exampleCHANGELOG.md— Added unreleased entryTest plan
go fmt,go vet,go buildall passallow_all_models = false, toggle true→false→trueallow_all_modelsgettrue(non-breaking)