Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Workflow](https://github.com/pinecone-io/terraform-provider-pinecone/actions/wor
![GitHub release (latest by
date)](https://img.shields.io/github/v/release/pinecone-io/terraform-provider-pinecone)

The Terraform Provider for Pinecone allows Terraform to manage Pinecone resources.
The Terraform Provider for Pinecone allows Terraform to manage Pinecone resources including indexes, collections, API keys, and projects.

Note: We take Terraform's security and our users' trust very seriously. If you
believe you have found a security issue in the Terraform Provider for Pinecone,
Expand Down Expand Up @@ -97,9 +97,9 @@ Remember, your API Key should be a protected secret. See how to
[protect sensitive input variables](https://developer.hashicorp.com/terraform/tutorials/configuration-language/sensitive-variables)
when setting your API Key this way.

#### Admin Operations (API Key Management)
#### Admin Operations (API Key and Project Management)

For creating and managing API keys, you need admin credentials (Client ID and Client Secret).
For creating and managing API keys and projects, you need admin credentials (Client ID and Client Secret).

##### Using Environment Variables

Expand All @@ -120,7 +120,28 @@ provider "pinecone" {
}
```

**Note**: Admin credentials are required for API key management operations. Regular API keys cannot be used to create or manage other API keys.
#### Example: Creating a Project

```terraform
# Create a basic project
resource "pinecone_project" "example" {
name = "my-production-project"
}

# Create a project with CMEK encryption
resource "pinecone_project" "encrypted" {
name = "secure-project"
force_encryption_with_cmek = true
}

# Create a project with custom pod limits
resource "pinecone_project" "custom_pods" {
name = "high-capacity-project"
max_pods = 10
}
```

**Note**: Admin credentials are required for API key and project management operations. Regular API keys cannot be used to create or manage other API keys or projects.

### API Key Management

Expand All @@ -137,6 +158,24 @@ The following roles can be assigned to API keys:
- `DataPlaneEditor`: Full access to data plane operations
- `DataPlaneViewer`: Read-only access to data plane operations

### Project Management

The Terraform Provider for Pinecone supports creating and managing Pinecone projects. This is useful for organizing your Pinecone resources and managing project-level configurations.

#### Project Features

- **Project Creation**: Create new projects with custom names
- **CMEK Encryption**: Enable customer-managed encryption keys for enhanced security
- **Pod Limits**: Configure maximum number of pods per project

#### Project Configuration Options

- `name`: The name of the project (required)
- `force_encryption_with_cmek`: Enable CMEK encryption (optional, cannot be disabled once enabled)
- `max_pods`: Maximum number of pods allowed in the project (optional, default varies by plan)

**Note**: Project management requires admin credentials (Client ID and Client Secret). Regular API keys cannot be used to manage projects.

## Documentation

Documentation can be found on the [Terraform
Expand Down
74 changes: 74 additions & 0 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "pinecone_project Data Source - terraform-provider-pinecone"
subcategory: ""
description: |-
Project data source
---

# pinecone_project (Data Source)

Project data source

## Example Usage

```terraform
terraform {
required_providers {
pinecone = {
source = "pinecone-io/pinecone"
}
}
}

provider "pinecone" {
client_id = var.client_id
client_secret = var.client_secret
}

# Read a specific project by ID
data "pinecone_project" "example" {
id = var.project_id
}

# Output the project details
output "project_name" {
description = "The name of the project"
value = data.pinecone_project.example.name
}

output "project_organization_id" {
description = "The organization ID of the project"
value = data.pinecone_project.example.organization_id
}

output "project_force_encryption_with_cmek" {
description = "Whether CMEK encryption is forced"
value = data.pinecone_project.example.force_encryption_with_cmek
}

output "project_max_pods" {
description = "The maximum number of pods allowed"
value = data.pinecone_project.example.max_pods
}

output "project_created_at" {
description = "When the project was created"
value = data.pinecone_project.example.created_at
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) Project identifier

### Read-Only

- `created_at` (String) The timestamp when the project was created.
- `force_encryption_with_cmek` (Boolean) Whether encryption with a customer-managed encryption key (CMEK) is forced.
- `max_pods` (Number) The maximum number of Pods that can be created in the project.
- `name` (String) The name of the project.
- `organization_id` (String) The organization ID where the project is located.
84 changes: 84 additions & 0 deletions docs/data-sources/projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "pinecone_projects Data Source - terraform-provider-pinecone"
subcategory: ""
description: |-
Projects data source
---

# pinecone_projects (Data Source)

Projects data source

## Example Usage

```terraform
terraform {
required_providers {
pinecone = {
source = "pinecone-io/pinecone"
}
}
}

provider "pinecone" {
client_id = var.client_id
client_secret = var.client_secret
}

# Read all available projects
data "pinecone_projects" "all" {}

# Output the count of projects
output "project_count" {
description = "Total number of projects"
value = length(data.pinecone_projects.all.projects)
}

# Output all project names
output "project_names" {
description = "Names of all projects"
value = [for project in data.pinecone_projects.all.projects : project.name]
}

# Output all project IDs
output "project_ids" {
description = "IDs of all projects"
value = [for project in data.pinecone_projects.all.projects : project.id]
}

# Output projects with CMEK encryption enabled
output "cmek_projects" {
description = "Projects with CMEK encryption enabled"
value = [for project in data.pinecone_projects.all.projects : project.name if project.force_encryption_with_cmek]
}

# Output projects with pod limits
output "projects_with_pod_limits" {
description = "Projects with pod limits configured"
value = [for project in data.pinecone_projects.all.projects : {
name = project.name
max_pods = project.max_pods
} if project.max_pods > 0]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Read-Only

- `id` (String) Projects identifier
- `projects` (Attributes List) List of the projects in your organization (see [below for nested schema](#nestedatt--projects))

<a id="nestedatt--projects"></a>
### Nested Schema for `projects`

Read-Only:

- `created_at` (String) The timestamp when the project was created.
- `force_encryption_with_cmek` (Boolean) Whether encryption with a customer-managed encryption key (CMEK) is forced.
- `id` (String) The unique ID of the project.
- `max_pods` (Number) The maximum number of Pods that can be created in the project.
- `name` (String) The name of the project.
- `organization_id` (String) The unique ID of the organization that the project belongs to.
85 changes: 85 additions & 0 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "pinecone_project Resource - terraform-provider-pinecone"
subcategory: ""
description: |-
The pinecone_project resource lets you create and manage projects in Pinecone. Learn more about projects in the docs https://docs.pinecone.io/guides/projects.
---

# pinecone_project (Resource)

The `pinecone_project` resource lets you create and manage projects in Pinecone. Learn more about projects in the [docs](https://docs.pinecone.io/guides/projects).

## Example Usage

```terraform
terraform {
required_providers {
pinecone = {
source = "pinecone-io/pinecone"
}
}
}

provider "pinecone" {
client_id = "your-client-id"
client_secret = "your-client-secret"
}

# Create a basic project
resource "pinecone_project" "example" {
name = "example-project"
}

# Create a project with CMEK encryption enabled
resource "pinecone_project" "encrypted" {
name = "encrypted-project"
force_encryption_with_cmek = true
}

# Create a project with custom max pods
resource "pinecone_project" "custom_pods" {
name = "custom-pods-project"
max_pods = 10
}

# Create a project with all options
resource "pinecone_project" "full_featured" {
name = "full-featured-project"
force_encryption_with_cmek = false
max_pods = 5
}

output "project_id" {
description = "The ID of the created project"
value = pinecone_project.example.id
}

output "project_name" {
description = "The name of the created project"
value = pinecone_project.example.name
}

output "organization_id" {
description = "The organization ID of the project"
value = pinecone_project.example.organization_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the project to be created.

### Optional

- `force_encryption_with_cmek` (Boolean) Whether to force encryption with a customer-managed encryption key (CMEK). Default is `false`. Once enabled, CMEK encryption cannot be disabled.
- `max_pods` (Number) The maximum number of Pods that can be created in the project. Default is `0` (serverless only).

### Read-Only

- `created_at` (String) The timestamp when the project was created.
- `id` (String) Project identifier
- `organization_id` (String) The organization ID where the project will be created.
9 changes: 8 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ The document generation tool looks for files in the following locations by defau

* **provider/provider.tf** example file for the provider index page
* **data-sources/`full data source name`/data-source.tf** example file for the named data source page
* **resources/`full resource name`/resource.tf** example file for the named data source page
* **resources/`full resource name`/resource.tf** example file for the named resource page

## Available Resources

* **pinecone_api_key** - Manage API keys in Pinecone projects
* **pinecone_collection** - Manage Pinecone collections
* **pinecone_index** - Manage Pinecone indexes
* **pinecone_project** - Manage Pinecone projects (requires admin credentials)
Loading
Loading