Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem committed Oct 24, 2023
1 parent bcd2bcd commit 07faccd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
2 changes: 1 addition & 1 deletion internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
// CLI command executed to create a provider server to which the CLI can
// reattach.
var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
"sodium": providerserver.NewProtocol6WithError(New("test")()),
"sodium": providerserver.NewProtocol6WithError(New()),
}

func testAccPreCheck(t *testing.T) {
Expand Down
39 changes: 10 additions & 29 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,12 @@ package main
import (
"context"
"flag"
"log"
"fmt"
"os"

"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/alchemy/terraform-provider-sodium/internal/provider"
)

// Run "go generate" to format example terraform files and generate the docs for the registry/website

// If you do not have terraform installed, you can remove the formatting command, but its suggested to
// ensure the documentation is formatted properly.
//go:generate terraform fmt -recursive ./examples/

// Run the docs generation tool, check its repository for more information on how it works and how docs
// can be customized.
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs

var (
// these will be set by the goreleaser configuration
// to appropriate values for the compiled binary.
version string = "dev"

// goreleaser can pass other information to the main package, such as the specific commit
// https://goreleaser.com/cookbooks/using-main.version/
"github.com/alchemy/terraform-provider-sodium/provider"
)

func main() {
Expand All @@ -37,15 +20,13 @@ func main() {
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
flag.Parse()

opts := providerserver.ServeOpts{
// TODO: Update this string with the published name of your provider.
Address: "registry.terraform.io/alchemy/sodium",
Debug: debug,
}

err := providerserver.Serve(context.Background(), provider.New(version), opts)

err := providerserver.Serve(context.Background(), provider.New, providerserver.ServeOpts{
Address: "registry.terraform.io/alchemy/sodium",
Debug: debug,
ProtocolVersion: 5,
})
if err != nil {
log.Fatal(err.Error())
fmt.Printf("failed to initialize provider: %v\n", err)
os.Exit(1)
}
}

0 comments on commit 07faccd

Please sign in to comment.