|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "openai_project_api_key Resource - terraform-provider-openai" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Project API key resource. |
| 7 | +--- |
| 8 | + |
| 9 | +# openai_project_api_key (Resource) |
| 10 | + |
| 11 | +Project API key resource. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +# Create an API key for the default project |
| 17 | +resource "openai_project_api_key" "example" { |
| 18 | + organization_id = "org-000000000000000000000000" |
| 19 | + service_account_id = "my-service-account" |
| 20 | +} |
| 21 | +
|
| 22 | +# Create an API key for a specific project |
| 23 | +resource "openai_project_api_key" "example" { |
| 24 | + organization_id = "org-000000000000000000000000" |
| 25 | + project_id = "proj_000000000000000000000000" |
| 26 | + service_account_id = "my-service-account" |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +<!-- schema generated by tfplugindocs --> |
| 31 | +## Schema |
| 32 | + |
| 33 | +### Required |
| 34 | + |
| 35 | +- `organization_id` (String) The ID of the organization to which the project belongs. |
| 36 | +- `service_account_id` (String) The ID of the service account to which the API key belongs. IDs can include letters, numbers, and hyphens. |
| 37 | + |
| 38 | +### Optional |
| 39 | + |
| 40 | +- `name` (String) The name of the API key. |
| 41 | +- `project_id` (String) The ID of the project. If not set, the default project will be used. |
| 42 | +- `scopes` (Set of String) The scopes of the API key. If not set, all scopes will be used. |
| 43 | + |
| 44 | +### Read-Only |
| 45 | + |
| 46 | +- `created` (Number) The timestamp when the API key was created. |
| 47 | +- `id` (String, Sensitive) The API key. |
| 48 | +- `redacted_key` (String, Sensitive) The redacted API key. |
| 49 | + |
| 50 | +## Import |
| 51 | + |
| 52 | +Import is supported using the following syntax: |
| 53 | + |
| 54 | +```shell |
| 55 | +# Import an existing API key for the default project |
| 56 | +terraform import openai_project_api_key.example organisation-id/secret-key |
| 57 | + |
| 58 | +# Example |
| 59 | +terraform import openai_project_api_key.example org-000000000000000000000000/sk-my-secret-key-xxxxx |
| 60 | + |
| 61 | +# Import an existing API key for a specific project |
| 62 | +terraform import openai_project_api_key.example organisation-id/project-id/secret-key |
| 63 | + |
| 64 | +# Example |
| 65 | +terraform import openai_project_api_key.example org-000000000000000000000000/proj_000000000000000000000000/sk-my-secret-key-xxxxx |
| 66 | +``` |
0 commit comments