Skip to content

Commit

Permalink
closes #8
Browse files Browse the repository at this point in the history
  • Loading branch information
skyscrapr authored and haruska committed Apr 10, 2024
1 parent 43b419d commit 85230bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 4 additions & 1 deletion docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,14 @@ Required:
Optional:

- `metadata_config` (Attributes) Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. These configurations are only valid for use with pod-based indexes. (see [below for nested schema](#nestedatt--spec--pod--metadata_config))
- `pods` (Number) The number of pods to be used in the index. This should be equal to shards x replicas.'
- `replicas` (Number) The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change.
- `shards` (Number) The number of shards. Shards split your data across multiple pods so you can fit more data into an index.
- `source_collection` (String) The name of the collection to create an index from.

Read-Only:

- `pods` (Number) The number of pods to be used in the index. This should be equal to shards x replicas.'

<a id="nestedatt--spec--pod--metadata_config"></a>
### Nested Schema for `spec.pod.metadata_config`

Expand Down
3 changes: 0 additions & 3 deletions pinecone/provider/index_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ func (r *IndexResource) Schema(ctx context.Context, req resource.SchemaRequest,
},
"pods": schema.Int64Attribute{
MarkdownDescription: "The number of pods to be used in the index. This should be equal to shards x replicas.'",
Optional: true,
Computed: true,
Default: int64default.StaticInt64(1),
},
"metadata_config": schema.SingleNestedAttribute{
Description: "Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when metadata_config is present, only specified metadata fields are indexed. These configurations are only valid for use with pod-based indexes.",
Expand Down Expand Up @@ -214,7 +212,6 @@ func (r *IndexResource) Create(ctx context.Context, req resource.CreateRequest,
PodType: spec.Pod.PodType.ValueString(),
Shards: int32(spec.Pod.ShardCount.ValueInt64()),
Replicas: int32(spec.Pod.Replicas.ValueInt64()),
// SourceCollection: spec.Pod.SourceCollection.ValueStringPointer(),
}

if !spec.Pod.SourceCollection.IsUnknown() {
Expand Down
11 changes: 5 additions & 6 deletions pinecone/provider/index_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ func TestAccIndexResource_pod_basic(t *testing.T) {
Steps: []resource.TestStep{
// Create and Read testing
{
Config: testAccIndexResourceConfig_pod_basic(rName, "1", "1"),
Config: testAccIndexResourceConfig_pod_basic(rName, "2"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("pinecone_index.test", "id", rName),
resource.TestCheckResourceAttr("pinecone_index.test", "name", rName),
resource.TestCheckResourceAttr("pinecone_index.test", "dimension", "1536"),
resource.TestCheckResourceAttr("pinecone_index.test", "metric", "cosine"),
resource.TestCheckResourceAttr("pinecone_index.test", "spec.pod.pod_type", "s1.x1"),
resource.TestCheckResourceAttr("pinecone_index.test", "spec.pod.replicas", "1"),
resource.TestCheckResourceAttr("pinecone_index.test", "spec.pod.pods", "1"),
resource.TestCheckResourceAttr("pinecone_index.test", "spec.pod.replicas", "2"),
resource.TestCheckResourceAttr("pinecone_index.test", "spec.pod.pods", "2"),
// resource.TestCheckNoResourceAttr("pinecone_index.test", "metadata_config"),
// resource.TestCheckNoResourceAttr("pinecone_index.test", "source_collection"),
),
Expand Down Expand Up @@ -134,7 +134,7 @@ resource "pinecone_index" "test" {
`, name)
}

func testAccIndexResourceConfig_pod_basic(name string, replicas string, pods string) string {
func testAccIndexResourceConfig_pod_basic(name string, replicas string) string {
return fmt.Sprintf(`
provider "pinecone" {
}
Expand All @@ -146,11 +146,10 @@ resource "pinecone_index" "test" {
environment = "us-west4-gcp"
pod_type = "s1.x1"
replicas = %q
pods = %q
}
}
}
`, name, replicas, pods)
`, name, replicas)
}

func testAccIndexResourceConfig_dimension(name string, dimension string) string {
Expand Down

0 comments on commit 85230bf

Please sign in to comment.