-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first data_source using terraform-plugin-framework
- Loading branch information
1 parent
0a7f43c
commit 95dfae2
Showing
11 changed files
with
1,035 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,59 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/plugin" | ||
"context" | ||
"flag" | ||
"log" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/providerserver" | ||
"github.com/hashicorp/terraform-plugin-go/tfprotov5" | ||
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server" | ||
"github.com/hashicorp/terraform-plugin-mux/tf5muxserver" | ||
"github.com/terraform-providers/terraform-provider-outscale/outscale" | ||
vers "github.com/terraform-providers/terraform-provider-outscale/version" | ||
) | ||
|
||
var ( | ||
version string = vers.GetVersion() | ||
) | ||
|
||
func main() { | ||
plugin.Serve(&plugin.ServeOpts{ | ||
ProviderFunc: outscale.Provider, | ||
}) | ||
|
||
var debug bool | ||
|
||
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve") | ||
flag.Parse() | ||
|
||
providers := []func() tfprotov5.ProviderServer{ | ||
providerserver.NewProtocol5(outscale.New(version)), // Example terraform-plugin-framework provider | ||
outscale.Provider().GRPCProvider, // Example terraform-plugin-sdk provider | ||
} | ||
|
||
//using muxer | ||
muxServer, err := tf5muxserver.NewMuxServer(context.Background(), providers...) | ||
|
||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
var serveOpts []tf5server.ServeOpt | ||
|
||
if debug { | ||
serveOpts = append(serveOpts, tf5server.WithManagedDebug()) | ||
} | ||
|
||
err = tf5server.Serve( | ||
"registry.terraform.io/providers/outscale/outscale/", | ||
muxServer.ProviderServer, | ||
serveOpts..., | ||
) | ||
|
||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
// plugin.Serve(&plugin.ServeOpts{ | ||
// ProviderFunc: outscale.Provider, | ||
// }) | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.