I am using terraform-plugin-framework v0.9.0. I am facing below error in main.go
./main.go:11:8: undefined: tfsdk.Serve
./main.go:11:55: undefined: tfsdk.ServeOpts
main.go
import (
“context”
“terraform-provider-testing/testing”
“github.com/hashicorp/terraform-plugin-framework/tfsdk”
)
func main() {
tfsdk.Serve(context.Background(), testing.New, tfsdk.ServeOpts{
Name: “testing”,
})
}
@bflad If possible, can you please help here?
bflad
3
Hi @akashgs Thank you for reaching out and sorry you are having trouble here.
The hashicups provider has not yet been updated for recent versions of the terraform-plugin-framework dependency, which we can track with Issue with hashicups provider for terraform-plugin-framework v0.9.0 · Issue #17 · hashicorp/terraform-provider-hashicups-pf · GitHub.
Recent versions of terraform-plugin-framework moved the provider server handling from the tfsdk
package to the providerserver
package. Additional documentation about the provider server handling in terraform-plugin-framework can be found at: Plugin Development - Framework: Provider Servers | Terraform by HashiCorp
So in this case, the code can be converted to:
package main
import (
"context"
"terraform-provider-testing/testing"
"github.com/hashicorp/terraform-plugin-framework/providerserver"
)
func main() {
providerserver.Serve(context.Background(), testing.New, providerserver.ServeOpts{
Address: "registry.terraform.io/hashicorp/testing", // update as appropriate
})
}
Go may require running the go mod tidy
command after saving this, to ensure it picks up dependencies appropriately.
Hope this helps.
Thanks, @bflad for the response. Any deadline for the v1.0.0 release for terraform-plugin-framework?