Skip to main content
Terraform is an infrastructure as code tool that lets you create, update, and version infrastructure by defining resources in configuration files. This allows for a repeated workflow for provisioning and managing your infrastructure. This page describes how to use the Terraform Provider for Pinecone to manage Pinecone indexes, collections, projects, API keys, service accounts, role bindings, invites, and users.

Requirements

Ensure you have the following:
Go >= v1.24 is required only if you build the provider from source. You don’t need Go to install the provider from the Terraform Registry.

Install the provider

  1. Configure the Pinecone provider in your Terraform configuration file:
  1. Append the following to your Terraform configuration file:
For an index with integrated embedding, dimension defaults to the model’s dimension. The model can’t be changed once set, but you can update field_map, read_parameters, and write_parameters. The read-only embed.effective_read_parameters and embed.effective_write_parameters attributes report the parameters the API applied, including server-side defaults you didn’t set.
You can update only the deletion protection, tags, integrated inference embedding settings, and read capacity of an index. Changing any other attribute — including name, dimension, metric, the cloud and region, or the metadata schema — replaces the index.

BYOC indexes

To create a BYOC index, set spec.byoc.environment to the environment identifier Pinecone provides for your deployment:

Pod-based indexes

Customers who sign up for a Standard or Enterprise plan on or after August 18, 2025 cannot create pod-based indexes. Instead, create serverless indexes, and consider using dedicated read nodes for large workloads (millions of records or more, and moderate or high query rates).
To create a pod-based index, set spec.pod:
Changing replicas, shards, or pod_type replaces the index, which deletes the records it holds. To scale a pod-based index in place, use the console or API instead.

Read capacity

Serverless and BYOC indexes support configurable read capacity through read_capacity inside the serverless or byoc spec. There are two modes: on_demand, which is the default, and dedicated, which provisions dedicated read nodes.
Set node_type to b1 or t1. The first time you switch an index to dedicated mode, node_type, replicas, and shards are all required.

Metadata schema

Serverless and BYOC indexes support a schema block that controls metadata indexing. By default, all metadata is indexed. When schema is present, only the fields you list with filterable = true are indexed.
You can set schema only when you create an index. Changing it replaces the index, which deletes the records it holds.

Timeouts

Index creation and deletion both time out after 5 minutes by default. To override this, set a timeouts block:

Collections

The pinecone_collection resource lets you create and delete collections for pod-based indexes. Set source to the name of the source index.
Collections also accept a timeouts block, with the same 5-minute defaults as indexes.

Projects

The pinecone_project resource lets you create, update, and delete projects. Once force_encryption_with_cmek is enabled, it can’t be disabled. max_pods defaults to 0, which allows serverless indexes only.
Customers who sign up for a Standard or Enterprise plan on or after August 18, 2025 cannot create pod-based indexes. Instead, create serverless indexes, and consider using dedicated read nodes for large workloads (millions of records or more, and moderate or high query rates).
Customers on those plans also can’t set max_pods for a project.

API keys

The pinecone_api_key resource lets you create, update, and delete API keys. Valid roles values are ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, and DataPlaneViewer. roles defaults to ["ProjectEditor"].
You can update only the name and roles of an API key. project_id is required when you create a key.
The generated secret is available as the read-only key attribute, which the API returns only once, at creation. Terraform stores it in plaintext in state. Marking it sensitive keeps it out of CLI output and logs, but does not encrypt it in state. Secure your state backend and never commit state to version control.

Service accounts

The pinecone_service_account resource lets you create, update, and delete service accounts. A service account authenticates with an OAuth client ID and secret. Grant it roles with a role binding.
To rotate a client secret, change rotate_trigger from one non-empty value to another. Setting it for the first time, or clearing it, establishes a baseline without rotating, so an existing credential is never invalidated unintentionally.
The client_secret attribute is returned only once, at creation or rotation, and Terraform stores it in plaintext in state. Marking it sensitive keeps it out of CLI output and logs, but does not encrypt it in state. Secure your state backend and never commit state to version control.

Role bindings

The pinecone_role_binding resource lets you grant a role to a principal at organization or project scope. For details on the role model, see Manage roles and access.
  • Set principal_type to user, service_account, or api_key, and principal_id to that principal’s ID.
  • Set resource_type to organization or project. For project scope, resource_id is required and must be the project ID. For organization scope, omit resource_id. The binding applies to the caller’s organization.
  • Organization-scoped role values are OrgOwner, OrgManager, OrgBillingAdmin, and OrgMember. Project-scoped values are ProjectOwner, ProjectManager, ProjectMember, ProjectEditor, ProjectViewer, ControlPlaneEditor, ControlPlaneViewer, DataPlaneEditor, and DataPlaneViewer.
Role bindings are immutable. Changing any attribute revokes the existing binding and creates a new one.
The pinecone_role_binding resource doesn’t accept principal_type = "invite". Pinecone moves an invite’s bindings to the user principal when the invite is accepted, so Terraform can’t manage them across that transition. To grant roles to someone who hasn’t joined your organization yet, use pinecone_invite, then manage their roles here with principal_type = "user" once they accept. The pinecone_role_bindings data source does accept invite, so you can still read what a pending invite granted.

Invites

The pinecone_invite resource manages an organization invitation, not the resulting membership. Creating it sends an invite to the given email with a set of initial roles. Deleting it revokes an invite that is still pending. The role_bindings list must include at least one organization-scoped role that grants membership.
The read-only status attribute reports pending, expired, or processed. Invites expire 7 days after creation, and the provider doesn’t expose a way to change that. Once an invite is accepted, its status is processed and Terraform stops acting on it. Destroying an accepted invite is a no-op.
Invites are immutable, so changing email or role_bindings sends a new invite. Don’t change either one after the invite is accepted — the replacement re-invites an address that already belongs to a member, and the operation fails. Manage an existing member’s roles with pinecone_role_binding instead.
Pinecone doesn’t return the roles an invite granted, so role_bindings is applied only at creation. Terraform can’t detect drift on it or recover it on import. To read the bindings, use the pinecone_role_bindings data source with principal_type = "invite".

Users

The pinecone_user resource manages an existing organization member. You can’t create or update users through Terraform. They join your organization by accepting an invite. Bring an existing user under management with terraform import. To change a user’s roles, use a role binding.
Destroying a pinecone_user resource removes that person from your organization. A terraform destroy, or removing the resource from your configuration, revokes a colleague’s access to every project in the organization.
The id attribute is immutable. To manage a different user, run terraform state rm on this resource and import the intended one.

Read existing resources

Data sources let you read resources that Terraform doesn’t manage. Most resource types have a singular data source that fetches one object and a plural data source that lists many.
Note the following behaviors:
  • For pinecone_user, set exactly one of id or email. Email matching is case-insensitive.
  • For pinecone_role_bindings, principal_type is required when you set principal_id, and resource_type is required when you set resource_id. You can’t filter by a binding’s own ID. Fetch it with the pinecone_role_binding data source instead.
  • pinecone_invites returns only pending and expired invites. To read an accepted invite, fetch it by ID with pinecone_invite.
  • The service account data sources never return client secrets.

Import existing resources

All resources support the terraform import command: For example:
Some attributes can’t be imported because Pinecone returns them only once:
  • pinecone_api_key.key and pinecone_service_account.client_secret stay empty in state for an imported resource. To issue and store a new service account secret, change rotate_trigger.
  • pinecone_invite.role_bindings stays empty in state, and Terraform proposes a replacement on the next plan until you set it to match the original invite. Use the pinecone_role_bindings data source with principal_type = "invite" to see what the invite granted.

Limitations

The Terraform Provider for Pinecone doesn’t support the following:

See also