2026-07.
Requirements
Ensure you have the following:- Terraform >= v1.4.6
- A Pinecone API key for managing indexes and collections
- A Pinecone service account for managing projects, API keys, service accounts, role bindings, invites, and users
Go >= v1.26 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
-
Configure the Pinecone provider in your Terraform configuration file:
Terraform
-
Run
terraform initto install the provider from the Terraform Registry. Alternatively, you can download the latest binary for your target platform from the GitHub repository.
Upgrade from v4
v5 is a major version. Most configurations written for v4 plan with no changes, but a few that v4 accepted are now rejected at plan time, before anything changes:- New pod-based indexes can’t be created, and neither can indexes created from a collection.
- On a legacy integrated index,
embedcan’t be added or removed, andembed.modelandembed.field_mapcan’t be changed. - The
spec.serverless.schemaandspec.byoc.schemametadata schema is deprecated. New indexes accept it only together withembed. - An index can’t switch from dedicated read capacity back to on-demand.
dimension,size, andvector_countonpinecone_collectionare read-only and can’t be set.
~> 5.1, run terraform init -upgrade, then run terraform plan and work through any errors. For each error and its fix, see the version 5 upgrade guide. For the full list of changes, see the v5.0.0, v5.1.0, and v5.1.1 release notes.
Authenticate
The provider uses two kinds of credentials, and each resource requires a specific one. The provider needs at least one of them and fails to configure if neither is set. If your configuration manages both indexes and organization-level resources, set both.
Follow these steps to authenticate:
-
Set environment variables for authentication:
-
Append the following to your Terraform configuration file:
Terraform
You can also set the API key and service account credentials as input variables.
Manage resources
The Terraform Provider for Pinecone provides the following resources:Indexes
Thepinecone_index resource lets you create, update, and delete indexes. It describes an index in one of two styles:
- The
schemastyle, withschemaanddeployment. This is how API version2026-07describes indexes, and it’s the style to use for new indexes. - The
specstyle, withdimension,metric,vector_type,spec, andembed. This is how earlier versions of the provider described indexes, and it’s planned for deprecation. Legacy integrated indexes and existing pod-based indexes still need it.
schema or deployment with dimension, metric, vector_type, spec, or embed.
Document indexes
Aschema of named fields creates a document index, which you read and write through the Documents API. Each field sets exactly one of dense_vector, sparse_vector, or string. A string field stores its text by default, and a field that stores its text is always indexed for full-text search. A string field can also use integrated embedding.
Terraform
full_text_search accepts language, stemming, stop_words, and ngram. ngram can’t be combined with stemming or stop_words.
Document indexes can run on managed (serverless) or BYOC deployments.
Integrated embedding
With provider v5.1.0 or later, astring field can use integrated embedding: Pinecone embeds the field’s text with a hosted model when you upsert or update documents, and embeds your query text when you search. Set embed for a dense model, sparse_embed for a sparse model, or both. {} selects the default model: llama-text-embed-v2 at its default dimension and metric for embed, and pinecone-sparse-english-v0 for sparse_embed.
Terraform
embedacceptsmodel,dimension,metric,read_parameters, andwrite_parameters.sparse_embedaccepts the same attributes exceptdimensionandmetric. For available models, see Models.- The read-only
effective_read_parametersandeffective_write_parametersattributes report the parameters the index uses, merged with the model’s defaults. - One field can set
full_text_search,embed, andsparse_embedtogether. Setfull_text_searchto configure full-text search on a field that stores its text. store_text = falseembeds the text and then discards it. Use it for fields you only search by similarity, or to keep sensitive text out of Pinecone. The field then can’t usefull_text_search,$match_*filters, orinclude_fields.- An index has one dense slot and one sparse slot. At most one field can be a
dense_vectorfield or setembed, and at most one can be asparse_vectorfield or setsparse_embed.
Vector indexes
A schema made only of the reserved fields_values (dense) and _sparse_values (sparse) creates a vector index, which you read and write through the Vectors API. _values always needs both dimension and metric.
Terraform
BYOC indexes
To create a BYOC index, setdeployment.byoc.environment to the environment identifier Pinecone provides for your deployment. The Pinecone API accepts document indexes on BYOC as long as no field uses integrated embedding. With provider v5.1.0 or later, BYOC indexes default to on-demand read capacity, like serverless indexes.
Terraform
Provider v5.0.0 requires
read_capacity.dedicated on new BYOC indexes. Upgrade to v5.1.0 or later to create on-demand BYOC indexes.Provider v5.1.0 and earlier reject document indexes and cmek_id on BYOC at plan time. Upgrade to v5.1.1 or later to use them.Read capacity
Serverless and BYOC indexes support configurable read capacity throughread_capacity. There are two modes: on_demand, which is the default, and dedicated, which provisions dedicated read nodes. In the schema style, set read_capacity at the top level of the resource.
Terraform
node_type to b1 or t1. The first time you switch an index to dedicated mode, node_type, replicas, and shards are all required. To select on-demand explicitly, set read_capacity = { on_demand = {} }.
Creating an index with read_capacity, or changing read_capacity, waits until the configured replicas and shards are running. If the change fails, the apply fails with the API’s error message. If a change to an existing index times out, it keeps going, and the next apply waits for it again.
Encryption
To encrypt an index with customer-managed encryption keys (CMEK), setcmek_id to the ID of your key. cmek_id is available only in the schema style, and only when you create the index. With provider v5.1.0 or earlier, it also requires a managed deployment.
Terraform
Update and recreate indexes
You can update the following attributes of an existing index in place:deletion_protectiontagsread_capacityembed.read_parametersandembed.write_parameterson a legacy integrated indexspec.pod.replicasandspec.pod.pod_typeon an existing pod-based index
name, schema, deployment, cmek_id, dimension, metric, vector_type, or spec.serverless.cloud and region replaces the index, which deletes the records it holds.
Some changes are rejected at plan time instead of replacing the index. These include removing integrated embedding from a field, changing embed on a legacy integrated index, and changing a pod-based index in a way that would need a new one. To recreate an index on purpose, taint it, then apply:
terraform apply -replace doesn’t get past these errors, because Terraform still plans the change against the existing index first. Use terraform taint instead.
Move an index to the schema style
You can move an existing vector index from thespec style to the schema style without replacing it. Rewrite the configuration to describe the same index, and the plan shows an in-place update that only changes Terraform state. The API isn’t called.
Terraform
The dimension, metric, and location must match the existing index, or the plan fails with
The configuration describes a different index. Set metric on _values even if the spec style left it to its default of cosine. If the plan shows a replacement, something besides the style changed, such as name. Check the configuration before you apply.
Legacy integrated indexes
Indexes created with the top-levelembed attribute are legacy integrated indexes. You read and write them through the legacy Records API. They still use the spec style, and existing configurations keep working. For new indexes, use integrated embedding on a document index instead.
Terraform
embed is fixed when you create the index. You can’t add or remove it, or change model or field_map, on an existing index. You can update read_parameters and write_parameters in place.
Pod-based indexes
API version2026-07 doesn’t support creating pod-based indexes, so the provider can’t create them either, including from a collection with spec.pod.source_collection. You can still import, scale, and delete existing pod-based indexes.
Terraform
replicas or pod_type scales the index in place, and the apply waits until scaling finishes. pod_type can only grow within the same pod family, for example from p1.x1 to p1.x2. Changes that would replace a pod-based index, such as to name, dimension, metric, environment, or shards, fail at plan time.
Timeouts
Index creation, updates, and deletion each time out after 10 minutes by default. Creation waits for the index and any read capacity it configures to be ready. Updates wait for read capacity changes and pod-based scaling to finish. To override the defaults, set atimeouts block:
Terraform
If creating an index times out, Terraform marks it tainted and replaces it on the next apply. When you create an index with dedicated read capacity, set
timeouts.create high enough for the read nodes to be provisioned.Collections
Thepinecone_collection resource lets you create and delete collections. Collections are created from pod-based indexes, which can no longer be created, so set source to the name of an existing pod-based index.
Terraform
dimension, size, and vector_count are read-only. Collections also accept a timeouts block for create and delete, each with a 10-minute default.
Projects
Thepinecone_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 on those plans also can’t set max_pods for a project.
Terraform
API keys
Thepinecone_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.Terraform
Service accounts
Thepinecone_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.
Terraform
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.
Role bindings
Thepinecone_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_typetouser,service_account, orapi_key, andprincipal_idto that principal’s ID. - Set
resource_typetoorganizationorproject. For project scope,resource_idis required and must be the project ID. For organization scope, omitresource_id. The binding applies to the caller’s organization. - Organization-scoped
rolevalues areOrgOwner,OrgManager,OrgBillingAdmin, andOrgMember. Project-scoped values areProjectOwner,ProjectManager,ProjectMember,ProjectEditor,ProjectViewer,ControlPlaneEditor,ControlPlaneViewer,DataPlaneEditor, andDataPlaneViewer.
Terraform
Role bindings are immutable. Changing any attribute revokes the existing binding and creates a new one.
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
Thepinecone_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’s still pending. The role_bindings list must include at least one organization-scoped role that grants membership.
Terraform
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.
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
Thepinecone_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.
Terraform
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.Terraform
pinecone_indexandpinecone_indexesreport each index’s fullschema, including the reserved vector fields and the metadata fields added as you upsert data. They also reportdeployment, top-levelread_capacity,private_host,cmek_id,source_backup_id, andsource_collection.dimension,metric, andvector_typeon the index data sources are derived from the schema, and are null when the schema doesn’t determine a single value, as for an index with only full-text-search fields. They’re planned for deprecation, so readschemainstead.- For
pinecone_user, set exactly one ofidoremail. Email matching is case-insensitive. - For
pinecone_role_bindings,principal_typeis required when you setprincipal_id, andresource_typeis required when you setresource_id. You can’t filter by a binding’s own ID. Fetch it with thepinecone_role_bindingdata source instead. pinecone_invitesreturns onlypendingandexpiredinvites. To read an accepted invite, fetch it by ID withpinecone_invite.- The service account data sources never return client secrets.
Import existing resources
All resources support theterraform import command:
For example:
schema style, and every other index in the spec style, however the index was created. You can still import a vector index into a schema style configuration. The next plan moves it with the same state-only update.
Provider v5.0.0 doesn’t record integrated embedding when it imports a document index. After you upgrade to v5.1.0, a plan for such an index fails with
Integrated embedding can't be removed from a field. To fix it, add embed = {} or sparse_embed = {} to the field so the configuration matches the index. The provider reads the model and other settings from the index, so the plan then shows no changes.pinecone_api_key.keyandpinecone_service_account.client_secretstay empty in state for an imported resource. To issue and store a new service account secret, changerotate_trigger.pinecone_invite.role_bindingsstays empty in state, and Terraform proposes a replacement on the next plan until you set it to match the original invite. Use thepinecone_role_bindingsdata source withprincipal_type = "invite"to see what the invite granted.
Limitations
The provider manages infrastructure only. You reference BYOC environments that Pinecone provisions for you. The provider doesn’t support the following:- Backups for serverless indexes, including restoring an index from a backup
- Creating pod-based indexes, or creating an index from a collection
- Private endpoints
- Assistants
- BYOC environment provisioning
- Data operations, such as upserting, querying, or deleting records and documents
Resources
- For the full provider documentation, see the Terraform Registry.
- For more usage examples, see the GitHub repository.
- For support requests, create an issue in the GitHub repository.