Skip to content

Commit e68e202

Browse files
committed
ImportBlockWithResourceIdentity
1 parent 8ce772e commit e68e202

File tree

8 files changed

+117
-51
lines changed

8 files changed

+117
-51
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/hashicorp/logutils v1.0.0
1616
github.com/hashicorp/terraform-exec v0.22.0
1717
github.com/hashicorp/terraform-json v0.24.0
18-
github.com/hashicorp/terraform-plugin-go v0.26.0
18+
github.com/hashicorp/terraform-plugin-go v0.27.0-alpha.1
1919
github.com/hashicorp/terraform-plugin-log v0.9.0
2020
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
2121
github.com/mitchellh/go-testing-interface v1.14.1
@@ -34,7 +34,7 @@ require (
3434
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
3535
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
3636
github.com/hashicorp/go-multierror v1.1.1 // indirect
37-
github.com/hashicorp/go-plugin v1.6.2 // indirect
37+
github.com/hashicorp/go-plugin v1.6.3 // indirect
3838
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
3939
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
4040
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
@@ -56,7 +56,7 @@ require (
5656
golang.org/x/text v0.23.0 // indirect
5757
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
5858
google.golang.org/appengine v1.6.8 // indirect
59-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
60-
google.golang.org/grpc v1.69.4 // indirect
61-
google.golang.org/protobuf v1.36.3 // indirect
59+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
60+
google.golang.org/grpc v1.71.0 // indirect
61+
google.golang.org/protobuf v1.36.5 // indirect
6262
)

go.sum

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB1
6161
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
6262
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
6363
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
64-
github.com/hashicorp/go-plugin v1.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8EiRVog=
65-
github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q=
64+
github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0UUrwg=
65+
github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0=
6666
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
6767
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
6868
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
@@ -80,8 +80,8 @@ github.com/hashicorp/terraform-exec v0.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8
8080
github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ=
8181
github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q=
8282
github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow=
83-
github.com/hashicorp/terraform-plugin-go v0.26.0 h1:cuIzCv4qwigug3OS7iKhpGAbZTiypAfFQmw8aE65O2M=
84-
github.com/hashicorp/terraform-plugin-go v0.26.0/go.mod h1:+CXjuLDiFgqR+GcrM5a2E2Kal5t5q2jb0E3D57tTdNY=
83+
github.com/hashicorp/terraform-plugin-go v0.27.0-alpha.1 h1:/IZFNUEafGnJGXRe2iNQQ+vtzEw/5qiD+gOxkFrNbi4=
84+
github.com/hashicorp/terraform-plugin-go v0.27.0-alpha.1/go.mod h1:Tf2HngbyKvovAlGXgBOVGm3EDvbNaN/StUaTXwrej4o=
8585
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
8686
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
8787
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1 h1:WNMsTLkZf/3ydlgsuXePa3jvZFwAJhruxTxP/c1Viuw=
@@ -150,16 +150,18 @@ github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70
150150
github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
151151
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
152152
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
153-
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
154-
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
155-
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
156-
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
157-
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
158-
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
159-
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
160-
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
161-
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
162-
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
153+
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
154+
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
155+
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
156+
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
157+
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
158+
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
159+
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
160+
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
161+
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
162+
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
163+
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
164+
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
163165
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
164166
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
165167
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
@@ -212,14 +214,14 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
212214
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
213215
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
214216
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
215-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE=
216-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
217-
google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A=
218-
google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
217+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI=
218+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50=
219+
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
220+
google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
219221
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
220222
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
221-
google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
222-
google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
223+
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
224+
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
223225
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
224226
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
225227
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

helper/resource/testing.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717

1818
"github.com/mitchellh/go-testing-interface"
1919

20+
"github.com/hashicorp/go-version"
2021
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
2122
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
2223

@@ -467,10 +468,30 @@ const (
467468
ImportBlockWithResourceIdentity
468469
)
469470

471+
// plannable returns true if this ImportStateKind uses the plannable import feature
470472
func (kind ImportStateKind) plannable() bool {
471473
return kind == ImportBlockWithID || kind == ImportBlockWithResourceIdentity
472474
}
473475

476+
// resourceIdentity returns true if this ImportStateKind uses resource identity
477+
func (kind ImportStateKind) resourceIdentity() bool {
478+
return kind == ImportBlockWithResourceIdentity
479+
}
480+
481+
// terraformVersion returns the minimum Terraform version that supports
482+
// the features required for this ImportStateKind.
483+
func (kind ImportStateKind) terraformVersion() *version.Version {
484+
switch kind {
485+
case ImportBlockWithID:
486+
return tfversion.Version1_5_0
487+
case ImportBlockWithResourceIdentity:
488+
return tfversion.Version1_12_0
489+
default:
490+
return tfversion.Version0_12_26 // Default to the earlist version supported by the testing framework
491+
}
492+
493+
}
494+
474495
func (kind ImportStateKind) String() string {
475496
return map[ImportStateKind]string{
476497
ImportCommandWithID: "ImportCommandWithID",

helper/resource/testing_new_import_state.go

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,18 @@ import (
2222
"github.com/hashicorp/terraform-plugin-testing/internal/plugintest"
2323
"github.com/hashicorp/terraform-plugin-testing/internal/teststep"
2424
"github.com/hashicorp/terraform-plugin-testing/terraform"
25-
"github.com/hashicorp/terraform-plugin-testing/tfversion"
2625
)
2726

2827
func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest.Helper, wd *plugintest.WorkingDir, step TestStep, cfgRaw string, providers *providerFactories, stepNumber int) error {
2928
t.Helper()
3029

3130
// step.ImportStateKind implicitly defaults to the zero-value (ImportCommandWithID) for backward compatibility
3231
kind := step.ImportStateKind
33-
if kind.plannable() {
34-
// Instead of calling [t.Fatal], return an error. This package's unit tests can use [TestStep.ExpectError] to match on the error message.
35-
// An alternative, [plugintest.TestExpectTFatal], does not have access to logged error messages, so it is open to false positives on this
36-
// complex code path.
37-
if err := requirePlannableImport(t, *helper.TerraformVersion()); err != nil {
38-
return err
39-
}
32+
// Instead of calling [t.Fatal], return an error. This package's unit tests can use [TestStep.ExpectError] to match on the error message.
33+
// An alternative, [plugintest.TestExpectTFatal], does not have access to logged error messages, so it is open to false positives on this
34+
// complex code path.
35+
if err := checkTerraformVersion(t, kind, *helper.TerraformVersion()); err != nil {
36+
return err
4037
}
4138

4239
configRequest := teststep.PrepareConfigurationRequest{
@@ -119,7 +116,11 @@ func testStepNewImportState(ctx context.Context, t testing.T, helper *plugintest
119116
}
120117

121118
if kind.plannable() {
122-
importConfig = appendImportBlock(importConfig, resourceName, importId)
119+
if kind.resourceIdentity() {
120+
importConfig = appendImportWithResourceIDBlock(importConfig, resourceName, importId)
121+
} else {
122+
importConfig = appendImportWithIDBlock(importConfig, resourceName, importId)
123+
}
123124
}
124125

125126
confRequest := teststep.PrepareConfigurationRequest{
@@ -459,7 +460,7 @@ func findResourceChangeInPlan(t testing.T, plan *tfjson.Plan, resourceName strin
459460
return nil
460461
}
461462

462-
func appendImportBlock(config string, resourceName string, importID string) string {
463+
func appendImportWithIDBlock(config string, resourceName string, importID string) string {
463464
return config + fmt.Sprintf(``+"\n"+
464465
`import {`+"\n"+
465466
` to = %s`+"\n"+
@@ -468,15 +469,25 @@ func appendImportBlock(config string, resourceName string, importID string) stri
468469
resourceName, importID)
469470
}
470471

471-
func requirePlannableImport(t testing.T, versionUnderTest version.Version) error {
472+
func appendImportWithResourceIDBlock(config string, resourceName string, importID string) string {
473+
return config + fmt.Sprintf(``+"\n"+
474+
`import {`+"\n"+
475+
` to = %s`+"\n"+
476+
` identity = {`+"\n"+
477+
` }`+"\n"+
478+
`}`+"\n",
479+
resourceName) //, importID)
480+
}
481+
482+
func checkTerraformVersion(t testing.T, kind ImportStateKind, versionUnderTest version.Version) error {
472483
t.Helper()
473484

474-
if versionUnderTest.LessThan(tfversion.Version1_5_0) {
485+
if versionUnderTest.Core().LessThan(kind.terraformVersion()) {
475486
return fmt.Errorf(
476-
`ImportState steps using plannable import blocks require Terraform 1.5.0 or later. Either ` +
477-
`upgrade the Terraform version running the test or add a ` + "`TerraformVersionChecks`" + ` to ` +
478-
`the test case to skip this test.` + "\n\n" +
479-
`https://developer.hashicorp.com/terraform/plugin/testing/acceptance-tests/tfversion-checks#skip-version-checks`)
487+
`%s steps require Terraform %s. Detected Terraform %s. Either upgrade the Terraform version running the test `+
488+
`or add `+"`TerraformVersionChecks`"+` to the test case to skip this test.`+"\n\n"+
489+
`https://developer.hashicorp.com/terraform/plugin/testing/acceptance-tests/tfversion-checks#skip-version-checks`,
490+
kind, kind.terraformVersion(), versionUnderTest)
480491
}
481492

482493
return nil

internal/testing/testprovider/provider.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ var _ provider.Provider = Provider{}
1717
// Provider is a declarative provider implementation for unit testing in this
1818
// Go module.
1919
type Provider struct {
20-
ConfigureResponse *provider.ConfigureResponse
21-
DataSources map[string]DataSource
22-
Resources map[string]Resource
23-
SchemaResponse *provider.SchemaResponse
24-
StopResponse *provider.StopResponse
25-
ValidateConfigResponse *provider.ValidateConfigResponse
20+
ConfigureResponse *provider.ConfigureResponse
21+
DataSources map[string]DataSource
22+
Resources map[string]Resource
23+
ResourceIdentitySchemas map[string]*tfprotov6.ResourceIdentitySchema
24+
SchemaResponse *provider.SchemaResponse
25+
StopResponse *provider.StopResponse
26+
ValidateConfigResponse *provider.ValidateConfigResponse
2627
}
2728

2829
func (p Provider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) {
@@ -51,6 +52,10 @@ func (p Provider) ResourcesMap() map[string]resource.Resource {
5152
return resources
5253
}
5354

55+
func (p Provider) ResourceIdentitySchema(ctx context.Context, req provider.ResourceIdentitySchemaRequest, resp *provider.ResourceIdentitySchemaResponse) {
56+
resp.ResourceIdentitySchemas = p.ResourceIdentitySchemas
57+
}
58+
5459
func (p Provider) Stop(ctx context.Context, req provider.StopRequest, resp *provider.StopResponse) {
5560
if p.StopResponse != nil {
5661
resp.Error = p.StopResponse.Error

internal/testing/testsdk/provider/provider.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
type Provider interface {
1616
Configure(context.Context, ConfigureRequest, *ConfigureResponse)
1717
DataSourcesMap() map[string]datasource.DataSource
18+
ResourceIdentitySchema(context.Context, ResourceIdentitySchemaRequest, *ResourceIdentitySchemaResponse)
1819
ResourcesMap() map[string]resource.Resource
1920
Schema(context.Context, SchemaRequest, *SchemaResponse)
2021
Stop(context.Context, StopRequest, *StopResponse)
@@ -29,6 +30,13 @@ type ConfigureResponse struct {
2930
Diagnostics []*tfprotov6.Diagnostic
3031
}
3132

33+
type ResourceIdentitySchemaRequest struct {
34+
}
35+
36+
type ResourceIdentitySchemaResponse struct {
37+
ResourceIdentitySchemas map[string]*tfprotov6.ResourceIdentitySchema
38+
}
39+
3240
type SchemaRequest struct{}
3341

3442
type SchemaResponse struct {

internal/testing/testsdk/providerserver/providerserver.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ type ProviderServer struct {
5858
Provider provider.Provider
5959
}
6060

61-
func (s ProviderServer) MoveResourceState(ctx context.Context, req *tfprotov6.MoveResourceStateRequest) (*tfprotov6.MoveResourceStateResponse, error) {
62-
return &tfprotov6.MoveResourceStateResponse{}, nil
63-
}
64-
6561
func (s ProviderServer) GetMetadata(ctx context.Context, request *tfprotov6.GetMetadataRequest) (*tfprotov6.GetMetadataResponse, error) {
6662
resp := &tfprotov6.GetMetadataResponse{
6763
// Functions and ephemeral resources not supported in this test SDK
@@ -821,3 +817,25 @@ func (s ProviderServer) CloseEphemeralResource(ctx context.Context, req *tfproto
821817
func (s ProviderServer) ValidateEphemeralResourceConfig(ctx context.Context, req *tfprotov6.ValidateEphemeralResourceConfigRequest) (*tfprotov6.ValidateEphemeralResourceConfigResponse, error) {
822818
return &tfprotov6.ValidateEphemeralResourceConfigResponse{}, nil
823819
}
820+
821+
func (s ProviderServer) GetResourceIdentitySchemas(ctx context.Context, request *tfprotov6.GetResourceIdentitySchemasRequest) (*tfprotov6.GetResourceIdentitySchemasResponse, error) {
822+
providerReq := provider.ResourceIdentitySchemaRequest{}
823+
providerResp := &provider.ResourceIdentitySchemaResponse{}
824+
825+
s.Provider.ResourceIdentitySchema(ctx, providerReq, providerResp)
826+
827+
resp := &tfprotov6.GetResourceIdentitySchemasResponse{
828+
IdentitySchemas: providerResp.ResourceIdentitySchemas,
829+
Diagnostics: []*tfprotov6.Diagnostic{},
830+
}
831+
832+
return resp, nil
833+
}
834+
835+
func (s ProviderServer) UpgradeResourceIdentity(ctx context.Context, request *tfprotov6.UpgradeResourceIdentityRequest) (*tfprotov6.UpgradeResourceIdentityResponse, error) {
836+
panic("implement me")
837+
}
838+
839+
func (s ProviderServer) MoveResourceState(ctx context.Context, req *tfprotov6.MoveResourceStateRequest) (*tfprotov6.MoveResourceStateResponse, error) {
840+
return &tfprotov6.MoveResourceStateResponse{}, nil
841+
}

tfversion/versions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ var (
3838
Version1_9_0 *version.Version = version.Must(version.NewVersion("1.9.0"))
3939
Version1_10_0 *version.Version = version.Must(version.NewVersion("1.10.0"))
4040
Version1_11_0 *version.Version = version.Must(version.NewVersion("1.11.0"))
41+
Version1_12_0 *version.Version = version.Must(version.NewVersion("1.12.0"))
4142
)

0 commit comments

Comments
 (0)