Skip to content

Commit a348cc1

Browse files
committed
feat: add sponsorship
1 parent be7b663 commit a348cc1

File tree

6 files changed

+72
-22
lines changed

6 files changed

+72
-22
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,25 @@ jobs:
6969
- "1.5.*"
7070
- "1.6.*"
7171
- "1.7.*"
72+
- "1.8.*"
73+
- "1.9.*"
74+
- "1.10.*"
75+
is-pr:
76+
- ${{ github.event_name == 'pull_request' }}
77+
# Only run the latest version of Terraform on pull requests
78+
exclude:
79+
- terraform: "1.4.*"
80+
is-pr: true
81+
- terraform: "1.5.*"
82+
is-pr: true
83+
- terraform: "1.6.*"
84+
is-pr: true
85+
- terraform: "1.7.*"
86+
is-pr: true
87+
- terraform: "1.8.*"
88+
is-pr: true
89+
- terraform: "1.9.*"
90+
is-pr: true
7291
steps:
7392
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7493
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Unofficial Terraform provider for OpenAI.
66

77
If you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.
88

9-
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/L3L71DQEL)
9+
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/jianyuan)
10+
[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/L3L71DQEL)
1011

1112
## Requirements
1213

docs/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@ page_title: "openai Provider"
44
subcategory: ""
55
description: |-
66
The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official Administration API https://platform.openai.com/docs/api-reference/administration to interact with the OpenAI platform.
7+
If you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.
8+
Github-sponsors https://github.com/sponsors/jianyuan
9+
Ko-Fi https://ko-fi.com/L3L71DQEL
710
---
811

912
# openai Provider
1013

1114
The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official [Administration API](https://platform.openai.com/docs/api-reference/administration) to interact with the OpenAI platform.
1215

16+
If you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.
17+
18+
[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/jianyuan)
19+
[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/L3L71DQEL)
20+
1321
## Example Usage
1422

1523
```terraform

internal/provider/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (p *OpenAIProvider) Metadata(ctx context.Context, req provider.MetadataRequ
4141

4242
func (p *OpenAIProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
4343
resp.Schema = schema.Schema{
44-
MarkdownDescription: "The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official [Administration API](https://platform.openai.com/docs/api-reference/administration) to interact with the OpenAI platform.",
44+
MarkdownDescription: "The OpenAI provider enables you to configure resources and data sources for your OpenAI organization. It utilizes the official [Administration API](https://platform.openai.com/docs/api-reference/administration) to interact with the OpenAI platform.\n\nIf you find this provider useful, please consider supporting me through GitHub Sponsorship or Ko-Fi to help with its development.\n\n[![Github-sponsors](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/jianyuan)\n[![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/L3L71DQEL)",
4545
Attributes: map[string]schema.Attribute{
4646
"base_url": schema.StringAttribute{
4747
MarkdownDescription: "Base URL for the OpenAI API. Defaults to `https://api.openai.com`.",

internal/provider/resource_project_rate_limit.go

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,24 @@ func (r *ProjectRateLimitResource) Create(ctx context.Context, req resource.Crea
112112
return
113113
}
114114

115-
body := apiclient.ProjectRateLimitUpdateRequest{
116-
MaxRequestsPer1Minute: data.MaxRequestsPer1Minute.ValueInt64Pointer(),
117-
MaxTokensPer1Minute: data.MaxTokensPer1Minute.ValueInt64Pointer(),
118-
MaxImagesPer1Minute: data.MaxImagesPer1Minute.ValueInt64Pointer(),
119-
MaxAudioMegabytesPer1Minute: data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer(),
120-
MaxRequestsPer1Day: data.MaxRequestsPer1Day.ValueInt64Pointer(),
121-
Batch1DayMaxInputTokens: data.Batch1DayMaxInputTokens.ValueInt64Pointer(),
115+
body := apiclient.ProjectRateLimitUpdateRequest{}
116+
if !data.MaxRequestsPer1Minute.IsUnknown() {
117+
body.MaxRequestsPer1Minute = data.MaxRequestsPer1Minute.ValueInt64Pointer()
118+
}
119+
if !data.MaxTokensPer1Minute.IsUnknown() {
120+
body.MaxTokensPer1Minute = data.MaxTokensPer1Minute.ValueInt64Pointer()
121+
}
122+
if !data.MaxImagesPer1Minute.IsUnknown() {
123+
body.MaxImagesPer1Minute = data.MaxImagesPer1Minute.ValueInt64Pointer()
124+
}
125+
if !data.MaxAudioMegabytesPer1Minute.IsUnknown() {
126+
body.MaxAudioMegabytesPer1Minute = data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer()
127+
}
128+
if !data.MaxRequestsPer1Day.IsUnknown() {
129+
body.MaxRequestsPer1Day = data.MaxRequestsPer1Day.ValueInt64Pointer()
130+
}
131+
if !data.Batch1DayMaxInputTokens.IsUnknown() {
132+
body.Batch1DayMaxInputTokens = data.Batch1DayMaxInputTokens.ValueInt64Pointer()
122133
}
123134

124135
httpResp, err := r.client.UpdateProjectRateLimitsWithResponse(
@@ -197,13 +208,24 @@ func (r *ProjectRateLimitResource) Update(ctx context.Context, req resource.Upda
197208
return
198209
}
199210

200-
body := apiclient.ProjectRateLimitUpdateRequest{
201-
MaxRequestsPer1Minute: data.MaxRequestsPer1Minute.ValueInt64Pointer(),
202-
MaxTokensPer1Minute: data.MaxTokensPer1Minute.ValueInt64Pointer(),
203-
MaxImagesPer1Minute: data.MaxImagesPer1Minute.ValueInt64Pointer(),
204-
MaxAudioMegabytesPer1Minute: data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer(),
205-
MaxRequestsPer1Day: data.MaxRequestsPer1Day.ValueInt64Pointer(),
206-
Batch1DayMaxInputTokens: data.Batch1DayMaxInputTokens.ValueInt64Pointer(),
211+
body := apiclient.ProjectRateLimitUpdateRequest{}
212+
if !data.MaxRequestsPer1Minute.IsUnknown() {
213+
body.MaxRequestsPer1Minute = data.MaxRequestsPer1Minute.ValueInt64Pointer()
214+
}
215+
if !data.MaxTokensPer1Minute.IsUnknown() {
216+
body.MaxTokensPer1Minute = data.MaxTokensPer1Minute.ValueInt64Pointer()
217+
}
218+
if !data.MaxImagesPer1Minute.IsUnknown() {
219+
body.MaxImagesPer1Minute = data.MaxImagesPer1Minute.ValueInt64Pointer()
220+
}
221+
if !data.MaxAudioMegabytesPer1Minute.IsUnknown() {
222+
body.MaxAudioMegabytesPer1Minute = data.MaxAudioMegabytesPer1Minute.ValueInt64Pointer()
223+
}
224+
if !data.MaxRequestsPer1Day.IsUnknown() {
225+
body.MaxRequestsPer1Day = data.MaxRequestsPer1Day.ValueInt64Pointer()
226+
}
227+
if !data.Batch1DayMaxInputTokens.IsUnknown() {
228+
body.Batch1DayMaxInputTokens = data.Batch1DayMaxInputTokens.ValueInt64Pointer()
207229
}
208230

209231
httpResp, err := r.client.UpdateProjectRateLimitsWithResponse(

internal/provider/resource_project_rate_limit_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ func TestAccProjectRateLimitResource(t *testing.T) {
2727
statecheck.ExpectKnownValue(rn, tfjsonpath.New("model"), knownvalue.StringExact("text-embedding-3-small")),
2828
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_requests_per_1_minute"), knownvalue.Int64Exact(3)),
2929
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_tokens_per_1_minute"), knownvalue.Int64Exact(3)),
30-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_images_per_1_minute"), knownvalue.NotNull()),
31-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_audio_megabytes_per_1_minute"), knownvalue.NotNull()),
30+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_images_per_1_minute"), knownvalue.Null()),
31+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_audio_megabytes_per_1_minute"), knownvalue.Null()),
3232
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_requests_per_1_day"), knownvalue.NotNull()),
33-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("batch_1_day_max_input_tokens"), knownvalue.NotNull()),
33+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("batch_1_day_max_input_tokens"), knownvalue.Null()),
3434
},
3535
},
3636
{
@@ -40,10 +40,10 @@ func TestAccProjectRateLimitResource(t *testing.T) {
4040
statecheck.ExpectKnownValue(rn, tfjsonpath.New("model"), knownvalue.StringExact("text-embedding-3-small")),
4141
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_requests_per_1_minute"), knownvalue.Int64Exact(2)),
4242
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_tokens_per_1_minute"), knownvalue.Int64Exact(2)),
43-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_images_per_1_minute"), knownvalue.NotNull()),
44-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_audio_megabytes_per_1_minute"), knownvalue.NotNull()),
43+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_images_per_1_minute"), knownvalue.Null()),
44+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_audio_megabytes_per_1_minute"), knownvalue.Null()),
4545
statecheck.ExpectKnownValue(rn, tfjsonpath.New("max_requests_per_1_day"), knownvalue.NotNull()),
46-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("batch_1_day_max_input_tokens"), knownvalue.NotNull()),
46+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("batch_1_day_max_input_tokens"), knownvalue.Null()),
4747
},
4848
},
4949
},

0 commit comments

Comments
 (0)