Skip to content

Commit

Permalink
Expose the provider package (#1427)
Browse files Browse the repository at this point in the history
* Expose the `provider` package
This will be used for the Crossplane provider.
This feature: https://blog.crossplane.io/new-providers-for-crossplane-donated-by-upbound-bring-up-to-4x-cost-savings/ requires a direct reference to the provider, making the Crossplane provider much faster because it doesn't have to call the TF CLI

* Fix import
  • Loading branch information
julienduchesne authored Mar 19, 2024
1 parent 32797d3 commit 0194058
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ terraform.tfplan
terraform.tfstate
bin/
modules-dev/
/pkg/
website/.vagrant
website/.bundle
website/build
Expand Down
2 changes: 1 addition & 1 deletion internal/testutils/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"

"github.com/Masterminds/semver/v3"
"github.com/grafana/terraform-provider-grafana/internal/provider"
"github.com/grafana/terraform-provider-grafana/pkg/provider"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-go/tftypes"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"flag"
"log"

"github.com/grafana/terraform-provider-grafana/internal/provider"
"github.com/grafana/terraform-provider-grafana/pkg/provider"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
)
Expand Down
3 changes: 3 additions & 0 deletions pkg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pkg

Note that while this code is exposed to other Golang projects, there is absolutely no compatibility guarantee between versions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"testing"

"github.com/grafana/terraform-provider-grafana/internal/common"
"github.com/grafana/terraform-provider-grafana/internal/provider"
"github.com/grafana/terraform-provider-grafana/internal/testutils"
"github.com/grafana/terraform-provider-grafana/pkg/provider"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion tools/genimports/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import (
"os"

"github.com/grafana/terraform-provider-grafana/internal/common"
"github.com/grafana/terraform-provider-grafana/internal/provider"
"github.com/grafana/terraform-provider-grafana/pkg/provider"
)

// TODO: Move to cmd, and remove global var in common

func main() {
p := provider.Provider("genimports") // Instantiate the provider so that all resources are registered
_ = p
Expand Down

0 comments on commit 0194058

Please sign in to comment.