package main import ( "context" "flag" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server" "github.com/hashicorp/terraform-plugin-mux/tf5to6server" "github.com/hashicorp/terraform-plugin-mux/tf6muxserver" "log" "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/xvlcwk-terraform/terraform-provider-bitbucketserver/bitbucket" ) func main() { ctx := context.Background() var debug bool flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve") flag.Parse() upgradedSdkServer, err := tf5to6server.UpgradeServer( ctx, // terraform-plugin-sdk provider bitbucket.Provider().GRPCProvider, //nolint:staticcheck ) if err != nil { log.Fatal(err) } providers := []func() tfprotov6.ProviderServer{ providerserver.NewProtocol6(bitbucket.New()), // Example terraform-plugin-framework provider func() tfprotov6.ProviderServer { return upgradedSdkServer }, } muxServer, err := tf6muxserver.NewMuxServer(ctx, providers...) if err != nil { log.Fatal(err) } var serveOpts []tf6server.ServeOpt if debug { serveOpts = append(serveOpts, tf6server.WithManagedDebug()) } err = tf6server.Serve( "registry.terraform.io/xvlcwk-terraform/terraform-provider-bitbucketserver", muxServer.ProviderServer, serveOpts..., ) if err != nil { log.Fatal(err) } }