@@ -76,10 +76,10 @@ func IdentityDynamicValueToValue(schema *tfprotov6.ResourceIdentitySchema, dynam
7676 }
7777
7878 if dynamicValue == nil {
79- return tftypes .NewValue (getIdentitySchemaValueType ( schema ), nil ), nil
79+ return tftypes .NewValue (schema . ValueType ( ), nil ), nil
8080 }
8181
82- value , err := dynamicValue .Unmarshal (getIdentitySchemaValueType ( schema ))
82+ value , err := dynamicValue .Unmarshal (schema . ValueType ( ))
8383
8484 if err != nil {
8585 diag := & tfprotov6.Diagnostic {
@@ -105,7 +105,7 @@ func IdentityValuetoDynamicValue(schema *tfprotov6.ResourceIdentitySchema, value
105105 return nil , diag
106106 }
107107
108- dynamicValue , err := tfprotov6 .NewDynamicValue (getIdentitySchemaValueType ( schema ), value )
108+ dynamicValue , err := tfprotov6 .NewDynamicValue (schema . ValueType ( ), value )
109109
110110 if err != nil {
111111 diag := & tfprotov6.Diagnostic {
@@ -119,42 +119,3 @@ func IdentityValuetoDynamicValue(schema *tfprotov6.ResourceIdentitySchema, value
119119
120120 return & dynamicValue , nil
121121}
122-
123- // TODO: This should be replaced by the `ValueType` method from plugin-go:
124- // https://github.com/hashicorp/terraform-plugin-go/pull/497
125- func getIdentitySchemaValueType (schema * tfprotov6.ResourceIdentitySchema ) tftypes.Type {
126- if schema == nil || schema .IdentityAttributes == nil {
127- return tftypes.Object {
128- AttributeTypes : map [string ]tftypes.Type {},
129- }
130- }
131- attributeTypes := map [string ]tftypes.Type {}
132-
133- for _ , attribute := range schema .IdentityAttributes {
134- if attribute == nil {
135- continue
136- }
137-
138- attributeType := getIdentityAttributeValueType (attribute )
139-
140- if attributeType == nil {
141- continue
142- }
143-
144- attributeTypes [attribute .Name ] = attributeType
145- }
146-
147- return tftypes.Object {
148- AttributeTypes : attributeTypes ,
149- }
150- }
151-
152- // TODO: This should be replaced by the `ValueType` method from plugin-go:
153- // https://github.com/hashicorp/terraform-plugin-go/pull/497
154- func getIdentityAttributeValueType (attr * tfprotov6.ResourceIdentitySchemaAttribute ) tftypes.Type {
155- if attr == nil {
156- return nil
157- }
158-
159- return attr .Type
160- }
0 commit comments