Skip to content

Commit

Permalink
refactor(provider): update docs definition
Browse files Browse the repository at this point in the history
  • Loading branch information
thiskevinwang committed Oct 5, 2023
1 parent ac9e198 commit b45af00
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 8 deletions.
29 changes: 29 additions & 0 deletions docs/data-sources/collection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "pinecone_collection Data Source - terraform-provider-pinecone"
subcategory: ""
description: |-
A Pinecone collection
- See Understanding collections https://docs.pinecone.io/docs/collections
- See API Docs https://docs.pinecone.io/reference/describe_collection
---

# pinecone_collection (Data Source)

A Pinecone collection
- See [Understanding collections](https://docs.pinecone.io/docs/collections)
- See [API Docs](https://docs.pinecone.io/reference/describe_collection)



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

### Required

- `name` (String) The name of the collection

### Read-Only

- `dimension` (Number) The dimension of the collection
- `id` (String) Example identifier
53 changes: 53 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "pinecone Provider"
subcategory: ""
description: |-
A Terraform provider for managing your pinecone.io https://www.pinecone.io/ infrastructure as code.
Example Usage
```hcl
provider "pinecone" {}
data "pinecone_collection" "existing-collection" {
name = "testindex"
}
resource "pinecone_index" "my-first-index" {
name = "testidx"
metric = "cosine"
pods = 1
sourcecollection = data.pineconecollection.existing-collection.name
dimension = data.pinecone_collection.existing-collection.dimension
}
```
---

# pinecone Provider

A Terraform provider for managing your [pinecone.io](https://www.pinecone.io/) infrastructure as code.

## Example Usage
```hcl
provider "pinecone" {}
data "pinecone_collection" "existing-collection" {
name = "testindex"
}
resource "pinecone_index" "my-first-index" {
name = "testidx"
metric = "cosine"
pods = 1
source_collection = data.pinecone_collection.existing-collection.name
dimension = data.pinecone_collection.existing-collection.dimension
}
```



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

### Optional

- `apikey` (String, Sensitive) Will use the `PINECONE_API_KEY` environment variable if not set.
- `environment` (String) Will use the `PINECONE_ENVIRONMENT` environment variable if not set.
32 changes: 32 additions & 0 deletions docs/resources/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "pinecone_index Resource - terraform-provider-pinecone"
subcategory: ""
description: |-
Manages an index.
---

# pinecone_index (Resource)

Manages an index.



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

### 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.

### Optional

- `metric` (String) The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.
- `pods` (Number) The number of pods for the index to use,including replicas.
- `replicas` (Number) The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.
- `source_collection` (String) The name of the collection to create an index from

### Read-Only

- `id` (String) Service generated identifier.
34 changes: 26 additions & 8 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,36 @@ func (p *pineconeProvider) Metadata(_ context.Context, _ provider.MetadataReques
// Schema defines the provider-level schema for configuration data.
func (p *pineconeProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Description: "Interact with Pinecone.io",
MarkdownDescription: `A Terraform provider for managing your [pinecone.io](https://www.pinecone.io/) infrastructure as code.
## Example Usage
` + "```hcl" + `
provider "pinecone" {}
data "pinecone_collection" "existing-collection" {
name = "testindex"
}
resource "pinecone_index" "my-first-index" {
name = "testidx"
metric = "cosine"
pods = 1
source_collection = data.pinecone_collection.existing-collection.name
dimension = data.pinecone_collection.existing-collection.dimension
}
` + "```",
Attributes: map[string]schema.Attribute{
"apikey": schema.StringAttribute{
Description: "...Or PINECONE_API_KEY",
Optional: true,
Required: false,
Sensitive: true,
MarkdownDescription: "Will use the `PINECONE_API_KEY` environment variable if not set.",
Optional: true,
Required: false,
Sensitive: true,
},
"environment": schema.StringAttribute{
Description: "...Or PINECONE_ENVIRONMENT",
Optional: true,
Required: false,
MarkdownDescription: "Will use the `PINECONE_ENVIRONMENT` environment variable if not set.",
Optional: true,
Required: false,
},
},
}
Expand Down

0 comments on commit b45af00

Please sign in to comment.