Skip to content

Commit

Permalink
feat: generate documentation (#9)
Browse files Browse the repository at this point in the history
* chore: gitignore `bin/*`

* feat: add `tools.go`

* chore: README

* refactor(provider): update docs definition
  • Loading branch information
thiskevinwang committed Oct 5, 2023
1 parent 2f79e6c commit 63efd05
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ terraform.tfstate.backup
.env

# Ignore goreleaser artifacts
dist/*
dist/*

# Ignore go tools artifacts
bin/*
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ cp .env.example .env
go test -v ./...
```

## Documenting

This uses `./tools/tools.go` to in stall [`tfplugindocs`](github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs)

```console
export GOBIN=$PWD/bin
export PATH=$GOBIN:$PATH
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
which tfplugindocs
```

Generate docs, and preview them at https://registry.terraform.io/tools/doc-preview

## Release

https://developer.hashicorp.com/terraform/registry/providers/publishing#publishing-to-the-registry
Expand Down
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.
20 changes: 17 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/thiskevinwang/terraform-provider-pinecone
go 1.21.1

require (
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.4.0
github.com/hashicorp/terraform-plugin-go v0.19.0
github.com/hashicorp/terraform-plugin-log v0.9.0
Expand All @@ -11,14 +12,20 @@ require (
)

require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
Expand All @@ -36,14 +43,21 @@ require (
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
Expand Down
Loading

0 comments on commit 63efd05

Please sign in to comment.