File tree 4 files changed +20
-455
lines changed
4 files changed +20
-455
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package datautil
2
2
3
3
import (
4
4
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/cfclient"
5
+ "hash/crc32"
5
6
)
6
7
7
8
// ConvertStringArr converts an array of interfaces to an array of strings.
@@ -55,3 +56,19 @@ func FlattenStringArr(sArr []string) []interface{} {
55
56
}
56
57
return iArr
57
58
}
59
+
60
+ // String hashes a string to a unique hashcode.
61
+ //
62
+ // Copied from github.com/hashicorp/terraform-plugin-sdk/helper/hashcode as it is removed in v2 and used within the provider.
63
+ // By copying the implementation we can avoid a dependency on the terraform-plugin-sdk which is no longer maintained.
64
+ func Hashcode (s string ) int {
65
+ v := int (crc32 .ChecksumIEEE ([]byte (s )))
66
+ if v >= 0 {
67
+ return v
68
+ }
69
+ if - v >= 0 {
70
+ return - v
71
+ }
72
+ // v == MinInt
73
+ return 0
74
+ }
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ import (
11
11
"github.com/Masterminds/semver"
12
12
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/cfclient"
13
13
"github.com/codefresh-io/terraform-provider-codefresh/codefresh/internal/schemautil"
14
+ "github.com/codefresh-io/terraform-provider-codefresh/codefresh/internal/datautil"
14
15
ghodss "github.com/ghodss/yaml"
15
- "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
16
16
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
17
17
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
18
18
"github.com/iancoleman/orderedmap"
@@ -333,7 +333,7 @@ func resourceStepTypesVersionsConfigHash(v interface{}) int {
333
333
cleanUpStepFromTransientValues (& stepTypes , "" , "" )
334
334
stepTypesYamlByteArray , _ := ghodss .Marshal (stepTypes )
335
335
buf .WriteString (string (stepTypesYamlByteArray ))
336
- hash := hashcode . String (buf .String ())
336
+ hash := datautil . Hashcode (buf .String ())
337
337
return hash
338
338
}
339
339
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ require (
9
9
github.com/ghodss/yaml v1.0.0
10
10
github.com/golangci/golangci-lint v1.64.8
11
11
github.com/hashicorp/go-cty v1.5.0
12
- github.com/hashicorp/terraform-plugin-sdk v1.17.2
12
+ github.com/hashicorp/terraform-plugin-docs v0.21.0
13
13
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1
14
14
github.com/iancoleman/orderedmap v0.3.0
15
15
github.com/mikefarah/yq/v4 v4.45.3
@@ -128,7 +128,6 @@ require (
128
128
github.com/hashicorp/logutils v1.0.0 // indirect
129
129
github.com/hashicorp/terraform-exec v0.22.0 // indirect
130
130
github.com/hashicorp/terraform-json v0.24.0 // indirect
131
- github.com/hashicorp/terraform-plugin-docs v0.21.0 // indirect
132
131
github.com/hashicorp/terraform-plugin-go v0.26.0 // indirect
133
132
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
134
133
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
You can’t perform that action at this time.
0 commit comments