Skip to content

Commit 8b4e506

Browse files
committed
chore(sdk): Serve the provider through a mux server
This is in preparation to migrate to the plugin framework.
1 parent 8fc9082 commit 8b4e506

17 files changed

+74
-70
lines changed

cloudamqp/provider_test.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cloudamqp
22

33
import (
4+
"context"
45
"fmt"
56
"net/http"
67
"net/url"
@@ -9,16 +10,15 @@ import (
910
"testing"
1011

1112
"github.com/cloudamqp/terraform-provider-cloudamqp/cloudamqp/vcr-testing/sanitizer"
13+
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
14+
"github.com/hashicorp/terraform-plugin-mux/tf5muxserver"
1215
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
13-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1416
"github.com/tidwall/gjson"
1517
"gopkg.in/dnaeon/go-vcr.v3/cassette"
1618
"gopkg.in/dnaeon/go-vcr.v3/recorder"
1719
)
1820

1921
var (
20-
testAccProviderFactory map[string]func() (*schema.Provider, error)
21-
2222
mode = recorder.ModeReplayOnly
2323
)
2424

@@ -155,10 +155,19 @@ func cloudamqpResourceTest(t *testing.T, c resource.TestCase) {
155155
return req.URL.Path == "/login"
156156
})
157157

158-
testAccProviderFactory = map[string]func() (*schema.Provider, error){
159-
"cloudamqp": func() (*schema.Provider, error) { return Provider("1.0", rec.GetDefaultClient()), nil },
158+
c.ProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){
159+
"cloudamqp": func() (tfprotov5.ProviderServer, error) {
160+
ctx := context.Background()
161+
162+
muxServer, err := tf5muxserver.NewMuxServer(ctx, Provider("1.0", rec.GetDefaultClient()).GRPCProvider)
163+
164+
if err != nil {
165+
return nil, err
166+
}
167+
168+
return muxServer.ProviderServer(), nil
169+
},
160170
}
161-
c.ProviderFactories = testAccProviderFactory
162171

163172
resource.Test(t, c)
164173
}

cloudamqp/resource_cloudamqp_alarm_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ func TestAccAlarm_Basic(t *testing.T) {
5656
)
5757

5858
cloudamqpResourceTest(t, resource.TestCase{
59-
PreCheck: func() { testAccPreCheck(t) },
60-
ProviderFactories: testAccProviderFactory,
59+
PreCheck: func() { testAccPreCheck(t) },
6160
Steps: []resource.TestStep{
6261
{
6362
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_aws_eventbridge_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ func TestAccIntegrationAwsEventbridge_Basic(t *testing.T) {
2626
)
2727

2828
cloudamqpResourceTest(t, resource.TestCase{
29-
PreCheck: func() { testAccPreCheck(t) },
30-
ProviderFactories: testAccProviderFactory,
29+
PreCheck: func() { testAccPreCheck(t) },
3130
Steps: []resource.TestStep{
3231
{
3332
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_extra_disk_size_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ func TestAccExtraDiskSize_AWS_Basic(t *testing.T) {
2525
)
2626

2727
cloudamqpResourceTest(t, resource.TestCase{
28-
PreCheck: func() { testAccPreCheck(t) },
29-
ProviderFactories: testAccProviderFactory,
28+
PreCheck: func() { testAccPreCheck(t) },
3029
Steps: []resource.TestStep{
3130
{
3231
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -58,8 +57,7 @@ func TestAccExtraDiskSize_GCE_Basic(t *testing.T) {
5857
)
5958

6059
cloudamqpResourceTest(t, resource.TestCase{
61-
PreCheck: func() { testAccPreCheck(t) },
62-
ProviderFactories: testAccProviderFactory,
60+
PreCheck: func() { testAccPreCheck(t) },
6361
Steps: []resource.TestStep{
6462
{
6563
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -91,8 +89,7 @@ func TestAccExtraDiskSize_Azure_Basic(t *testing.T) {
9189
)
9290

9391
cloudamqpResourceTest(t, resource.TestCase{
94-
PreCheck: func() { testAccPreCheck(t) },
95-
ProviderFactories: testAccProviderFactory,
92+
PreCheck: func() { testAccPreCheck(t) },
9693
Steps: []resource.TestStep{
9794
{
9895
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_instance_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ func TestAccInstance_Basic(t *testing.T) {
3232
)
3333

3434
cloudamqpResourceTest(t, resource.TestCase{
35-
PreCheck: func() { testAccPreCheck(t) },
36-
ProviderFactories: testAccProviderFactory,
35+
PreCheck: func() { testAccPreCheck(t) },
3736
Steps: []resource.TestStep{
3837
{
3938
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -94,8 +93,7 @@ func TestAccInstance_Upgrade(t *testing.T) {
9493
}
9594
)
9695
cloudamqpResourceTest(t, resource.TestCase{
97-
PreCheck: func() { testAccPreCheck(t) },
98-
ProviderFactories: testAccProviderFactory,
96+
PreCheck: func() { testAccPreCheck(t) },
9997
Steps: []resource.TestStep{
10098
{
10199
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -144,8 +142,7 @@ func TestAccInstance_PlanChange(t *testing.T) {
144142
)
145143

146144
cloudamqpResourceTest(t, resource.TestCase{
147-
PreCheck: func() { testAccPreCheck(t) },
148-
ProviderFactories: testAccProviderFactory,
145+
PreCheck: func() { testAccPreCheck(t) },
149146
Steps: []resource.TestStep{
150147
{
151148
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -187,8 +184,7 @@ func TestAccInstance_Downgrade(t *testing.T) {
187184
)
188185

189186
cloudamqpResourceTest(t, resource.TestCase{
190-
PreCheck: func() { testAccPreCheck(t) },
191-
ProviderFactories: testAccProviderFactory,
187+
PreCheck: func() { testAccPreCheck(t) },
192188
Steps: []resource.TestStep{
193189
{
194190
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_integration_log_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ func TestAccIntegrationLog_Basic(t *testing.T) {
5454
)
5555

5656
cloudamqpResourceTest(t, resource.TestCase{
57-
PreCheck: func() { testAccPreCheck(t) },
58-
ProviderFactories: testAccProviderFactory,
57+
PreCheck: func() { testAccPreCheck(t) },
5958
Steps: []resource.TestStep{
6059
{
6160
ExpectNonEmptyPlan: true,

cloudamqp/resource_cloudamqp_integration_metric_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ func TestAccIntegrationMetric_Basic(t *testing.T) {
3939
)
4040

4141
cloudamqpResourceTest(t, resource.TestCase{
42-
PreCheck: func() { testAccPreCheck(t) },
43-
ProviderFactories: testAccProviderFactory,
42+
PreCheck: func() { testAccPreCheck(t) },
4443
Steps: []resource.TestStep{
4544
{
4645
ExpectNonEmptyPlan: true,

cloudamqp/resource_cloudamqp_notification_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func TestAccNotification_Basic(t *testing.T) {
3333
)
3434

3535
cloudamqpResourceTest(t, resource.TestCase{
36-
PreCheck: func() { testAccPreCheck(t) },
37-
ProviderFactories: testAccProviderFactory,
36+
PreCheck: func() { testAccPreCheck(t) },
3837
Steps: []resource.TestStep{
3938
{
4039
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_plugin_community_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ func TestAccPluginCommunity_Basic(t *testing.T) {
3636
)
3737

3838
cloudamqpResourceTest(t, resource.TestCase{
39-
PreCheck: func() { testAccPreCheck(t) },
40-
ProviderFactories: testAccProviderFactory,
39+
PreCheck: func() { testAccPreCheck(t) },
4140
Steps: []resource.TestStep{
4241
{
4342
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_plugin_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ func TestAccPlugin_Basic(t *testing.T) {
3636
)
3737

3838
cloudamqpResourceTest(t, resource.TestCase{
39-
PreCheck: func() { testAccPreCheck(t) },
40-
ProviderFactories: testAccProviderFactory,
39+
PreCheck: func() { testAccPreCheck(t) },
4140
Steps: []resource.TestStep{
4241
{
4342
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_rabbitmq_configuration_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ func TestAccRabbitMqConfiguration_Basic(t *testing.T) {
2626
)
2727

2828
cloudamqpResourceTest(t, resource.TestCase{
29-
PreCheck: func() { testAccPreCheck(t) },
30-
ProviderFactories: testAccProviderFactory,
29+
PreCheck: func() { testAccPreCheck(t) },
3130
Steps: []resource.TestStep{
3231
{
3332
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -68,8 +67,7 @@ func TestAccRabbitMqConfiguration_LogExhangeLevel(t *testing.T) {
6867
)
6968

7069
cloudamqpResourceTest(t, resource.TestCase{
71-
PreCheck: func() { testAccPreCheck(t) },
72-
ProviderFactories: testAccProviderFactory,
70+
PreCheck: func() { testAccPreCheck(t) },
7371
Steps: []resource.TestStep{
7472
{
7573
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_security_firewall_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ func TestAccFirewall_Basic(t *testing.T) {
3737
)
3838

3939
cloudamqpResourceTest(t, resource.TestCase{
40-
PreCheck: func() { testAccPreCheck(t) },
41-
ProviderFactories: testAccProviderFactory,
40+
PreCheck: func() { testAccPreCheck(t) },
4241
Steps: []resource.TestStep{
4342
{
4443
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_vpc_connect_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ func TestAccVpcConnect_AWS_Basic(t *testing.T) {
4242
)
4343

4444
cloudamqpResourceTest(t, resource.TestCase{
45-
PreCheck: func() { testAccPreCheck(t) },
46-
ProviderFactories: testAccProviderFactory,
45+
PreCheck: func() { testAccPreCheck(t) },
4746
Steps: []resource.TestStep{
4847
{
4948
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -96,8 +95,7 @@ func TestAccVpcConnect_Azure_Basic(t *testing.T) {
9695
)
9796

9897
cloudamqpResourceTest(t, resource.TestCase{
99-
PreCheck: func() { testAccPreCheck(t) },
100-
ProviderFactories: testAccProviderFactory,
98+
PreCheck: func() { testAccPreCheck(t) },
10199
Steps: []resource.TestStep{
102100
{
103101
Config: configuration.GetTemplatedConfig(t, fileNames, params),
@@ -139,8 +137,7 @@ func TestAccVpcConnect_GCP_Basic(t *testing.T) {
139137
)
140138

141139
cloudamqpResourceTest(t, resource.TestCase{
142-
PreCheck: func() { testAccPreCheck(t) },
143-
ProviderFactories: testAccProviderFactory,
140+
PreCheck: func() { testAccPreCheck(t) },
144141
Steps: []resource.TestStep{
145142
{
146143
Config: configuration.GetTemplatedConfig(t, fileNames, params),

cloudamqp/resource_cloudamqp_webhook_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ func TestAccWebhook_Basic(t *testing.T) {
3535
)
3636

3737
cloudamqpResourceTest(t, resource.TestCase{
38-
PreCheck: func() { testAccPreCheck(t) },
39-
ProviderFactories: testAccProviderFactory,
38+
PreCheck: func() { testAccPreCheck(t) },
4039
Steps: []resource.TestStep{
4140
{
4241
Config: configuration.GetTemplatedConfig(t, fileNames, params),

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ toolchain go1.22.2
66

77
require (
88
github.com/dghubble/sling v1.4.2
9+
github.com/hashicorp/terraform-plugin-go v0.23.0
10+
github.com/hashicorp/terraform-plugin-mux v0.16.0
911
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
1012
github.com/tidwall/gjson v1.17.1
1113
github.com/tidwall/sjson v1.2.5
@@ -19,7 +21,7 @@ require (
1921
github.com/cloudflare/circl v1.3.7 // indirect
2022
github.com/dghubble/sling v1.4.2 // indirect
2123
github.com/fatih/color v1.16.0 // indirect
22-
github.com/golang/protobuf v1.5.3 // indirect
24+
github.com/golang/protobuf v1.5.4 // indirect
2325
github.com/google/go-cmp v0.6.0 // indirect
2426
github.com/google/go-querystring v1.1.0 // indirect
2527
github.com/hashicorp/errwrap v1.0.0 // indirect
@@ -36,7 +38,6 @@ require (
3638
github.com/hashicorp/logutils v1.0.0 // indirect
3739
github.com/hashicorp/terraform-exec v0.20.0 // indirect
3840
github.com/hashicorp/terraform-json v0.21.0 // indirect
39-
github.com/hashicorp/terraform-plugin-go v0.22.0 // indirect
4041
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
4142
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
4243
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
@@ -61,8 +62,8 @@ require (
6162
golang.org/x/sys v0.18.0 // indirect
6263
golang.org/x/text v0.14.0 // indirect
6364
google.golang.org/appengine v1.6.8 // indirect
64-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
65-
google.golang.org/grpc v1.61.1 // indirect
66-
google.golang.org/protobuf v1.33.0 // indirect
65+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
66+
google.golang.org/grpc v1.63.2 // indirect
67+
google.golang.org/protobuf v1.34.0 // indirect
6768
gopkg.in/yaml.v3 v3.0.1 // indirect
6869
)

go.sum

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4er
3838
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
3939
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
4040
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
41-
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
42-
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
41+
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
42+
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
4343
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
4444
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
4545
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -77,10 +77,12 @@ github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8J
7777
github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw=
7878
github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U=
7979
github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk=
80-
github.com/hashicorp/terraform-plugin-go v0.22.0 h1:1OS1Jk5mO0f5hrziWJGXXIxBrMe2j/B8E+DVGw43Xmc=
81-
github.com/hashicorp/terraform-plugin-go v0.22.0/go.mod h1:mPULV91VKss7sik6KFEcEu7HuTogMLLO/EvWCuFkRVE=
80+
github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co=
81+
github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ=
8282
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
8383
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
84+
github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQsWn/ZECEiW7p2023I=
85+
github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo=
8486
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8=
8587
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A=
8688
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
@@ -204,14 +206,14 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
204206
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
205207
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
206208
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
207-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14=
208-
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA=
209-
google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY=
210-
google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
209+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
210+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
211+
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
212+
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
211213
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
212214
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
213-
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
214-
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
215+
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
216+
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
215217
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
216218
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
217219
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

main.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
package main
22

33
import (
4+
"context"
5+
"log"
46
"net/http"
57

68
"github.com/cloudamqp/terraform-provider-cloudamqp/cloudamqp"
7-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8-
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
9+
"github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server"
10+
"github.com/hashicorp/terraform-plugin-mux/tf5muxserver"
911
)
1012

1113
var version string
1214

1315
func main() {
14-
plugin.Serve(&plugin.ServeOpts{
15-
ProviderFunc: func() *schema.Provider {
16-
return cloudamqp.Provider(version, http.DefaultClient)
17-
},
18-
})
16+
ctx := context.Background()
17+
18+
muxServer, err := tf5muxserver.NewMuxServer(ctx, cloudamqp.Provider(version, http.DefaultClient).GRPCProvider)
19+
20+
if err != nil {
21+
log.Fatal(err)
22+
}
23+
24+
err = tf5server.Serve(
25+
"registry.terraform.io/cloudamqp/cloudamqp",
26+
muxServer.ProviderServer,
27+
)
28+
29+
if err != nil {
30+
log.Fatal(err)
31+
}
1932
}

0 commit comments

Comments
 (0)