File tree Expand file tree Collapse file tree 1 file changed +2
-20
lines changed
stackit/internal/conversion Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Original file line number Diff line number Diff line change @@ -151,26 +151,8 @@ func StringListToPointer(list basetypes.ListValue) (*[]string, error) {
151151// It returns nil if the value is null or unknown.
152152// Note: It sorts the resulting slice to ensure deterministic behavior.
153153func StringSetToPointer (set basetypes.SetValue ) (* []string , error ) {
154- if set .IsNull () || set .IsUnknown () {
155- return nil , nil
156- }
157-
158- elements := set .Elements ()
159- result := make ([]string , 0 , len (elements ))
160-
161- for i , el := range elements {
162- elStr , ok := el .(types.String )
163- if ! ok {
164- return nil , fmt .Errorf ("element %d in set is not a string (type: %T)" , i , el )
165- }
166- result = append (result , elStr .ValueString ())
167- }
168-
169- // Because Sets are unordered in Terraform, we sort here to
170- // prevent non-deterministic behavior in the provider logic or API calls.
171- sort .Strings (result )
172-
173- return & result , nil
154+ result , err := StringSetToSlice (set )
155+ return & result , err
174156}
175157
176158// StringSetToSlice converts basetypes.SetValue to a slice of strings.
You can’t perform that action at this time.
0 commit comments