Skip to content

Commit 31000f0

Browse files
committed
feat: add AI Gateway, Governance, and Access Control resources
## New Resources - portkey_integration: Manage AI provider integrations (OpenAI, Anthropic, etc.) - portkey_provider: Manage providers/virtual keys for workspace-scoped AI access - portkey_config: Gateway configurations with routing and fallbacks - portkey_prompt: Versioned prompt templates - portkey_guardrail: Content validation and safety checks - portkey_usage_limits_policy: Cost controls and spending limits - portkey_rate_limits_policy: Request rate limiting - portkey_api_key: Organization and workspace API keys ## New Data Sources - portkey_integration, portkey_integrations - portkey_provider, portkey_providers - portkey_config, portkey_configs - portkey_prompt, portkey_prompts - portkey_guardrail, portkey_guardrails - portkey_usage_limits_policy, portkey_usage_limits_policies - portkey_rate_limits_policy, portkey_rate_limits_policies - portkey_api_key, portkey_api_keys ## Tests - Full acceptance test coverage for all new resources - 39 tests passing ## Documentation - Updated README with new resources and examples - Added AI Gateway example - Updated CHANGELOG, AVAILABLE_APIS, RESOURCE_MATRIX ## Known Issues - Workspace deletion blocked by backend 'phantom virtual keys' issue - Workspace member API has inconsistent responses (tests skipped)
1 parent 6bd88aa commit 31000f0

73 files changed

Lines changed: 11048 additions & 609 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,53 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
test:
13+
lint:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
2018

2119
- name: Set up Go
2220
uses: actions/setup-go@v5
2321
with:
2422
go-version-file: 'go.mod'
2523
cache: true
2624

27-
- name: Cache Go build
28-
uses: actions/cache@v4
25+
- name: Run golangci-lint
26+
uses: golangci/golangci-lint-action@v6
27+
with:
28+
version: latest
29+
30+
- name: Check Go formatting
31+
run: |
32+
if [ -n "$(gofmt -l .)" ]; then
33+
echo "Go files are not formatted. Run 'make fmt'"
34+
gofmt -d .
35+
exit 1
36+
fi
37+
38+
- name: Check Terraform formatting
39+
run: |
40+
terraform fmt -check -recursive ./examples/ || {
41+
echo "Terraform files are not formatted. Run 'make fmt'"
42+
exit 1
43+
}
44+
45+
test:
46+
runs-on: ubuntu-latest
47+
needs: lint
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v5
2954
with:
30-
path: |
31-
~/.cache/go-build
32-
~/go/pkg/mod
33-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
34-
restore-keys: ${{ runner.os }}-go-
55+
go-version-file: 'go.mod'
56+
cache: true
3557

3658
- name: Build
3759
run: go build ./...
3860

3961
- name: Unit tests
40-
run: go test ./... -count=1
62+
run: go test ./... -v -count=1

.golangci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: "2"
2+
3+
run:
4+
timeout: 5m
5+
modules-download-mode: readonly
6+
7+
linters:
8+
# Use defaults (errcheck, govet, ineffassign, staticcheck, unused) plus:
9+
enable:
10+
- misspell # Finds misspellings
11+
- bodyclose # Checks HTTP response body is closed
12+
13+
formatters:
14+
enable:
15+
- gofmt # Checks formatting
16+
- goimports # Checks imports formatting
17+
18+
issues:
19+
max-issues-per-linter: 0
20+
max-same-issues: 0

CHANGELOG.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- **AI Gateway Resources:**
12+
- `portkey_integration` - Manage AI provider integrations (OpenAI, Anthropic, Azure, etc.)
13+
- `portkey_provider` - Manage providers/virtual keys for workspace-scoped AI access
14+
- `portkey_config` - Manage gateway configurations with routing and fallbacks
15+
- `portkey_prompt` - Manage versioned prompt templates
16+
- **Governance Resources:**
17+
- `portkey_guardrail` - Set up content validation and safety checks
18+
- `portkey_usage_limits_policy` - Control costs with spending limits
19+
- `portkey_rate_limits_policy` - Manage request rate limiting
20+
- **Access Control Resources:**
21+
- `portkey_api_key` - Create and manage Portkey API keys
22+
- **Data Sources for all new resources:**
23+
- `portkey_integration`, `portkey_integrations`
24+
- `portkey_provider`, `portkey_providers`
25+
- `portkey_config`, `portkey_configs`
26+
- `portkey_prompt`, `portkey_prompts`
27+
- `portkey_guardrail`, `portkey_guardrails`
28+
- `portkey_usage_limits_policy`, `portkey_usage_limits_policies`
29+
- `portkey_rate_limits_policy`, `portkey_rate_limits_policies`
30+
- `portkey_api_key`, `portkey_api_keys`
31+
1032
## [0.1.0] - TBD
1133

1234
### Added
1335
- Initial release of the Portkey Terraform Provider
14-
- **Resources:**
36+
- **Organization Resources:**
1537
- `portkey_workspace` - Manage Portkey workspaces
1638
- `portkey_workspace_member` - Manage workspace membership
1739
- `portkey_user_invite` - Send user invitations with workspace access and scopes
@@ -34,9 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3456

3557
### Known Limitations
3658
- User invitations cannot be updated (must delete and recreate)
37-
- Virtual Keys resource not yet implemented
38-
- Configs resource not yet implemented
39-
- API Keys resource not yet implemented
59+
- Workspace deletion may be blocked by existing resources
60+
- Prompt template updates create new versions (use makeDefault to promote)
4061

4162
[Unreleased]: https://github.com/Portkey-AI/terraform-provider-portkey/compare/v0.1.0...HEAD
4263
[0.1.0]: https://github.com/Portkey-AI/terraform-provider-portkey/releases/tag/v0.1.0

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@ fmt:
2323
gofmt -s -w -e .
2424
terraform fmt -recursive ./examples/
2525

26-
# Lint
26+
# Lint code
2727
lint:
2828
golangci-lint run
2929

30+
# Run all checks (same as CI)
31+
check: fmt lint
32+
go build ./...
33+
go test ./... -v -count=1
34+
3035
# Clean build artifacts
3136
clean:
3237
rm -f terraform-provider-portkey
3338
rm -rf ~/.terraform.d/plugins/registry.terraform.io/portkey-ai/
3439

35-
.PHONY: default generate testacc build install fmt lint clean
40+
.PHONY: default generate testacc build install fmt lint check clean

0 commit comments

Comments
 (0)