diff --git a/docs/resources/index.md b/docs/resources/index.md index e721954..9f0bd6e 100644 --- a/docs/resources/index.md +++ b/docs/resources/index.md @@ -42,12 +42,12 @@ resource "pinecone_index" "test" { ### Required +- `dimension` (Number) The dimensions of the vectors to be inserted in the index - `name` (String) The name of the index to be created. The maximum length is 45 characters. - `spec` (Attributes) Spec (see [below for nested schema](#nestedatt--spec)) ### Optional -- `dimension` (Number) The dimensions of the vectors to be inserted in the index - `metric` (String) The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) diff --git a/examples/data-sources/pinecone_collection/data-source.tf b/examples/data-sources/pinecone_collection/data-source.tf index e833203..88c1a93 100644 --- a/examples/data-sources/pinecone_collection/data-source.tf +++ b/examples/data-sources/pinecone_collection/data-source.tf @@ -12,6 +12,7 @@ provider "pinecone" { resource "pinecone_index" "test" { name = "tftestindex" + dimension = 10 spec = { pod = { environment = "us-west4-gcp" diff --git a/examples/data-sources/pinecone_index/data-source.tf b/examples/data-sources/pinecone_index/data-source.tf index 1d38c2e..e2cd383 100644 --- a/examples/data-sources/pinecone_index/data-source.tf +++ b/examples/data-sources/pinecone_index/data-source.tf @@ -12,6 +12,7 @@ provider "pinecone" { resource "pinecone_index" "test" { name = "tftestindex" + dimension = 10 spec = { serverless = { cloud = "aws" diff --git a/examples/data-sources/pinecone_indexes/data-source.tf b/examples/data-sources/pinecone_indexes/data-source.tf index d5809e5..4c6d9b8 100644 --- a/examples/data-sources/pinecone_indexes/data-source.tf +++ b/examples/data-sources/pinecone_indexes/data-source.tf @@ -12,6 +12,7 @@ provider "pinecone" { resource "pinecone_index" "test" { name = "tftestindex" + dimension = 10 spec = { serverless = { cloud = "aws" diff --git a/examples/resources/pinecone_collection/resource.tf b/examples/resources/pinecone_collection/resource.tf index 134f849..8ffb160 100644 --- a/examples/resources/pinecone_collection/resource.tf +++ b/examples/resources/pinecone_collection/resource.tf @@ -12,6 +12,7 @@ provider "pinecone" { resource "pinecone_index" "test" { name = "tftestindex" + dimension = 10 spec = { pod = { environment = "us-west4-gcp" diff --git a/examples/resources/pinecone_index/resource.tf b/examples/resources/pinecone_index/resource.tf index d3ae670..04eb5a8 100644 --- a/examples/resources/pinecone_index/resource.tf +++ b/examples/resources/pinecone_index/resource.tf @@ -7,12 +7,12 @@ terraform { } provider "pinecone" { - environment = "us-west4-gcp" # api_key = set via PINECONE_API_KEY env variable } resource "pinecone_index" "test" { name = "tftestindex" + dimension = 10 spec = { serverless = { cloud = "aws" diff --git a/pinecone/provider/index_resource.go b/pinecone/provider/index_resource.go index d521f7e..345bc06 100644 --- a/pinecone/provider/index_resource.go +++ b/pinecone/provider/index_resource.go @@ -67,9 +67,7 @@ func (r *IndexResource) Schema(ctx context.Context, req resource.SchemaRequest, }, "dimension": schema.Int64Attribute{ MarkdownDescription: "The dimensions of the vectors to be inserted in the index", - Optional: true, - Computed: true, - Default: int64default.StaticInt64(1536), + Required: true, Validators: []validator.Int64{ int64validator.AtLeast(1), }, diff --git a/pinecone/provider/index_resource_test.go b/pinecone/provider/index_resource_test.go index 1ea296d..ad02663 100644 --- a/pinecone/provider/index_resource_test.go +++ b/pinecone/provider/index_resource_test.go @@ -124,6 +124,7 @@ provider "pinecone" { resource "pinecone_index" "test" { name = %q + dimension = 1536 spec = { serverless = { cloud = "aws" @@ -141,6 +142,7 @@ provider "pinecone" { resource "pinecone_index" "test" { name = %q + dimension = 1536 spec = { pod = { environment = "us-west4-gcp"