-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add User-Agent header * use provider.UserAgent func * set user-agent header on http client constructor * fix tests * add version to main serve provider * fix tests structure after provider change * use nicer types
- Loading branch information
Showing
5 changed files
with
117 additions
and
67 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
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 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 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 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,35 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
"github.com/env0/terraform-provider-env0/env0" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin" | ||
"log" | ||
) | ||
|
||
//go:generate terraform fmt -recursive ./examples/ | ||
|
||
var ( | ||
// these will be set by the goreleaser configuration | ||
// to appropriate values for the compiled binary | ||
version string = "dev" | ||
) | ||
|
||
func main() { | ||
plugin.Serve(&plugin.ServeOpts{ | ||
ProviderFunc: env0.Provider, | ||
}) | ||
var debugMode bool | ||
flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve") | ||
flag.Parse() | ||
|
||
opts := &plugin.ServeOpts{ProviderFunc: env0.Provider(version)} | ||
|
||
if debugMode { | ||
err := plugin.Debug(context.Background(), "registry.terraform.io/env0/env0", opts) | ||
if err != nil { | ||
log.Fatal(err.Error()) | ||
} | ||
return | ||
} | ||
|
||
plugin.Serve(opts) | ||
} |