Skip to content

Commit

Permalink
SUP-1370 Update to protocol v6 (#400)
Browse files Browse the repository at this point in the history
* Update to protocol v6

* Update changelog
  • Loading branch information
jradtilbrook authored Sep 12, 2023
1 parent a751517 commit 07b91a4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ All notable changes to this project will be documented in this file.
- SUP-1394 Add validation to provider_settings [[PR #387](https://github.com/buildkite/terraform-provider-buildkite/pull/387)] @jradtilbrook
- SUP-1382: Remove the deprecated team block from pipelines [[PR #391](https://github.com/buildkite/terraform-provider-buildkite/pull/391)] @lizrabuya
- retryContextError util resource switch [[PR #394](https://github.com/buildkite/terraform-provider-buildkite/pull/394)] @james2791
- Added `build_pull_request_ready_for_review` to pipeline resource docs/examples/tests[[PR #396](https://github.com/buildkite/terraform-provider-buildkite/pull/396)] @james2791
- Added `build_pull_request_ready_for_review` to pipeline resource docs/examples/tests [[PR #396](https://github.com/buildkite/terraform-provider-buildkite/pull/396)] @james2791
- SUP-1370 Update to protocol v6 [[PR #400](https://github.com/buildkite/terraform-provider-buildkite/pull/400)] @jradtilbrook

The `team` block from the `buildkite_pipeline` resource has been removed. Please use the resource `buildkite_pipeline_team` to create and manage team configuration in a pipeline.

Expand Down
6 changes: 3 additions & 3 deletions buildkite/data_source_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAccBuildkiteClusterDatasource(t *testing.T) {
clusterName := acctest.RandString(12)

resource.ParallelTest(t, resource.TestCase{
ProtoV5ProviderFactories: protoV5ProviderFactories(),
ProtoV6ProviderFactories: protoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
Expand All @@ -38,7 +38,7 @@ func TestAccBuildkiteClusterDatasource(t *testing.T) {
t.Run("can find a cluster", func(t *testing.T) {
clusterName := acctest.RandString(12)
resource.ParallelTest(t, resource.TestCase{
ProtoV5ProviderFactories: protoV5ProviderFactories(),
ProtoV6ProviderFactories: protoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
Expand All @@ -60,7 +60,7 @@ func TestAccBuildkiteClusterDatasource(t *testing.T) {

t.Run("errors if cannot find cluster", func(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
ProtoV5ProviderFactories: protoV5ProviderFactories(),
ProtoV6ProviderFactories: protoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Config: `data "buildkite_cluster" "default" {
Expand Down
7 changes: 0 additions & 7 deletions buildkite/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

genqlient "github.com/Khan/genqlient/graphql"
"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/shurcooL/graphql"
)
Expand All @@ -32,12 +31,6 @@ func init() {
organizationID, _ = GetOrganizationID(getenv("BUILDKITE_ORGANIZATION_SLUG"), graphqlClient)
}

func protoV5ProviderFactories() map[string]func() (tfprotov5.ProviderServer, error) {
return map[string]func() (tfprotov5.ProviderServer, error){
"buildkite": providerserver.NewProtocol5WithError(New("testing")),
}
}

func protoV6ProviderFactories() map[string]func() (tfprotov6.ProviderServer, error) {
return map[string]func() (tfprotov6.ProviderServer, error){
"buildkite": providerserver.NewProtocol6WithError(New("testing")),
Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/buildkite/terraform-provider-buildkite/buildkite"
"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
"github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server"
)

// Set at compile time from ldflags
Expand All @@ -20,15 +20,15 @@ func main() {
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
flag.Parse()

var serveOpts []tf5server.ServeOpt
var serveOpts []tf6server.ServeOpt

if debug {
serveOpts = append(serveOpts, tf5server.WithManagedDebug())
serveOpts = append(serveOpts, tf6server.WithManagedDebug())
}

err := tf5server.Serve(
err := tf6server.Serve(
"registry.terraform.io/buildkite/buildkite",
providerserver.NewProtocol5(buildkite.New(version)),
providerserver.NewProtocol6(buildkite.New(version)),
serveOpts...,
)

Expand Down
4 changes: 3 additions & 1 deletion terraform-registry-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"version": 1,
"metadata": {
"protocol_versions": ["5.0"]
"protocol_versions": [
"6.0"
]
}
}

0 comments on commit 07b91a4

Please sign in to comment.