thiskevinwang / terraform-provider-pinecone

Terraform Provider for managing resources on Pinecone.io
https://registry.terraform.io/providers/thiskevinwang/pinecone/latest
MIT License
5 stars 1 forks source link

Error: Resource Type Not Found when trying to use examples/resource #11

Open admeeer opened 7 months ago

admeeer commented 7 months ago

Using the example in examples/resource and then running terraform init then terraform plan gives me:

│ Error: Resource Type Not Found
│
│   with pinecone_index.my-first-index,
│   on main.tf line 19, in resource "pinecone_index" "my-first-index":
│   19: resource "pinecone_index" "my-first-index" {
│
│ No resource type named "pinecone_index" was found in the provider.

Is this a registry issue? I have this in main.tf, and when I run terraform init it successfully installs the binary.

...
  required_providers {
    pinecone = {
      source  = "thiskevinwang/pinecone"
    }
  }
...
thiskevinwang commented 7 months ago

Hey @admeeer, it's been a while since I've touched this code, but that does seem like an odd error. Here are two things that come to mind:

  1. Can you pin the provider version and retry?
terraform {
  required_providers {
    pinecone = {
      source = "thiskevinwang/pinecone"
      version = "0.1.2"
    }
  }
}

provider "pinecone" {
  # Configuration options
}
  1. If that still doesn't fix anything, what's your output when running with debug?
TF_LOG=DEBUG terraform plan
admeeer commented 7 months ago

I created a new project with just the examples/resource and your revisions. Here's the log from that:

2024-01-14T20:23:18.590-0700 [INFO]  Terraform version: 1.6.6
2024-01-14T20:23:18.591-0700 [DEBUG] using github.com/hashicorp/go-tfe v1.36.0
2024-01-14T20:23:18.591-0700 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1
2024-01-14T20:23:18.591-0700 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-01-14T20:23:18.591-0700 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2024-01-14T20:23:18.591-0700 [INFO]  Go runtime version: go1.21.5
2024-01-14T20:23:18.591-0700 [INFO]  CLI args: []string{"C:\\Program Files (x86)\\Terraform\\terraform.exe", "plan"}
2024-01-14T20:23:18.594-0700 [DEBUG] Attempting to open CLI config file: C:\Users\alex\AppData\Roaming\terraform.rc
2024-01-14T20:23:18.594-0700 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-01-14T20:23:18.595-0700 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-01-14T20:23:18.595-0700 [DEBUG] ignoring non-existing provider search directory C:\Users\alex\AppData\Roaming\terraform.d\plugins
2024-01-14T20:23:18.595-0700 [DEBUG] ignoring non-existing provider search directory C:\Users\alex\AppData\Roaming\HashiCorp\Terraform\plugins
2024-01-14T20:23:18.595-0700 [INFO]  CLI command args: []string{"plan"}
2024-01-14T20:23:18.597-0700 [DEBUG] New state was assigned lineage "666c6ec3-ceb2-946b-42ec-3a6dea1fbcfd"
2024-01-14T20:23:18.636-0700 [DEBUG] checking for provisioner in "."
2024-01-14T20:23:18.636-0700 [DEBUG] checking for provisioner in "C:\\Program Files (x86)\\Terraform"
2024-01-14T20:23:18.637-0700 [INFO]  backend/local: starting Plan operation
2024-01-14T20:23:18.650-0700 [DEBUG] created provider logger: level=debug
2024-01-14T20:23:18.650-0700 [INFO]  provider: configuring client automatic mTLS
2024-01-14T20:23:18.723-0700 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe args=[".terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe"]
2024-01-14T20:23:18.742-0700 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe pid=34648
2024-01-14T20:23:18.742-0700 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe
2024-01-14T20:23:18.756-0700 [INFO]  provider.terraform-provider-pinecone_v0.1.2.exe: configuring server automatic mTLS: timestamp=2024-01-14T20:23:18.755-0700
2024-01-14T20:23:18.828-0700 [DEBUG] provider: using plugin: version=6
2024-01-14T20:23:18.828-0700 [DEBUG] provider.terraform-provider-pinecone_v0.1.2.exe: plugin address: address=127.0.0.1:10000 network=tcp timestamp=2024-01-14T20:23:18.828-0700
2024-01-14T20:23:18.874-0700 [DEBUG] provider.terraform-provider-pinecone_v0.1.2.exe: indexResource.Metadata: @module=pinecone req=map[ProviderTypeName:pinecone] resp=map[TypeName:] tf_rpc=GetProviderSchema @caller=github.com/thiskevinwang/terraform-provider-pinecone/internal/resources/index.go:53 tf_provider_addr=thekevinwang.com/terraform-providers/pinecone tf_req_id=a88ae6d7-0952-731a-3968-daa695085723 timestamp=2024-01-14T20:23:18.874-0700
2024-01-14T20:23:18.875-0700 [DEBUG] provider.terraform-provider-pinecone_v0.1.2.exe: indexResource.Schema: @caller=github.com/thiskevinwang/terraform-provider-pinecone/internal/resources/index.go:60 @module=pinecone req=map[] resp="map[Diagnostics:<nil> Schema:map[Attributes:<nil> Blocks:<nil> DeprecationMessage: Description: MarkdownDescription: Version:0]]" tf_provider_addr=thekevinwang.com/terraform-providers/pinecone tf_req_id=a88ae6d7-0952-731a-3968-daa695085723 tf_rpc=GetProviderSchema timestamp=2024-01-14T20:23:18.874-0700
2024-01-14T20:23:18.875-0700 [DEBUG] No provider meta schema returned
2024-01-14T20:23:18.876-0700 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-01-14T20:23:18.884-0700 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe pid=34648
2024-01-14T20:23:18.884-0700 [DEBUG] provider: plugin exited
2024-01-14T20:23:18.884-0700 [DEBUG] Building and walking validate graph
2024-01-14T20:23:18.884-0700 [DEBUG] ProviderTransformer: "pinecone_index.my-first-index" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/thiskevinwang/pinecone"]
2024-01-14T20:23:18.885-0700 [DEBUG] ReferenceTransformer: "var.PINECONE_ENVIRONMENT" references: []
2024-01-14T20:23:18.885-0700 [DEBUG] ReferenceTransformer: "var.PINECONE_API_KEY" references: []
2024-01-14T20:23:18.885-0700 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/thiskevinwang/pinecone\"]" references: [var.PINECONE_API_KEY var.PINECONE_ENVIRONMENT]
2024-01-14T20:23:18.885-0700 [DEBUG] ReferenceTransformer: "pinecone_index.my-first-index" references: []
2024-01-14T20:23:18.885-0700 [DEBUG] Starting graph walk: walkValidate
2024-01-14T20:23:18.886-0700 [DEBUG] created provider logger: level=debug
2024-01-14T20:23:18.886-0700 [INFO]  provider: configuring client automatic mTLS
2024-01-14T20:23:18.914-0700 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe args=[".terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe"]
2024-01-14T20:23:18.918-0700 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe pid=44848
2024-01-14T20:23:18.918-0700 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe
2024-01-14T20:23:18.930-0700 [INFO]  provider.terraform-provider-pinecone_v0.1.2.exe: configuring server automatic mTLS: timestamp=2024-01-14T20:23:18.929-0700
2024-01-14T20:23:19.002-0700 [DEBUG] provider.terraform-provider-pinecone_v0.1.2.exe: plugin address: address=127.0.0.1:10000 network=tcp timestamp=2024-01-14T20:23:19.002-0700
2024-01-14T20:23:19.002-0700 [DEBUG] provider: using plugin: version=6
2024-01-14T20:23:19.047-0700 [DEBUG] provider.terraform-provider-pinecone_v0.1.2.exe: indexResource.Metadata: req=map[ProviderTypeName:] tf_provider_addr=thekevinwang.com/terraform-providers/pinecone tf_req_id=4ac718a6-ce2e-6d81-ed6f-7a880990f079 tf_resource_type=pinecone_index @caller=github.com/thiskevinwang/terraform-provider-pinecone/internal/resources/index.go:53 @module=pinecone resp=map[TypeName:] tf_rpc=ValidateResourceConfig timestamp=2024-01-14T20:23:19.046-0700
2024-01-14T20:23:19.047-0700 [ERROR] vertex "pinecone_index.my-first-index" error: Resource Type Not Found
2024-01-14T20:23:19.047-0700 [ERROR] provider.terraform-provider-pinecone_v0.1.2.exe: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail="No resource type named \"pinecone_index\" was found in the provider." tf_proto_version=6.4 diagnostic_severity=ERROR diagnostic_summary="Resource Type Not Found" tf_req_id=4ac718a6-ce2e-6d81-ed6f-7a880990f079 tf_rpc=ValidateResourceConfig @module=sdk.proto tf_provider_addr=thekevinwang.com/terraform-providers/pinecone tf_resource_type=pinecone_index timestamp=2024-01-14T20:23:19.047-0700
╷
│ Error: Resource Type Not Found
│
│   with pinecone_index.my-first-index,
│   on main.tf line 6, in resource "pinecone_index" "my-first-index":
│    6: resource "pinecone_index" "my-first-index" {
│
│ No resource type named "pinecone_index" was found in the provider.
╵
2024-01-14T20:23:19.049-0700 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-01-14T20:23:19.068-0700 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/thiskevinwang/pinecone/0.1.2/windows_386/terraform-provider-pinecone_v0.1.2.exe pid=44848
2024-01-14T20:23:19.068-0700 [DEBUG] provider: plugin exited
thiskevinwang commented 7 months ago

From https://github.com/hashicorp/terraform/issues/33990

Provider works fine as it does with Terraform v1.5

@admeeer Can you try Terraform v1.5?

admeeer commented 7 months ago

@thiskevinwang That works!

According to https://github.com/hashicorp/terraform/issues/33990 and then https://github.com/hashicorp/terraform-plugin-framework/issues/853 it looks like the issue was fixed in terraform-plugin-framework v1.4.1.

I did a little further testing and it looks like just pointing the terraform-plugin-framework require in go.mod to v1.4.1 works. Re-compiling the binary with that change and then using that binary as a local provider with Terraform v1.6.6 worked. If you agree, see https://github.com/thiskevinwang/terraform-provider-pinecone/pull/12