Skip to content

Commit

Permalink
Pull request #1043: opensearch tf provider hash func fix
Browse files Browse the repository at this point in the history
Merge in CLOUD/terraform-provider-yandex-mirror from os_tf_provider_hash_fix to master

Squashed commit of the following:

commit 41f533697819964757f094f82b859f7a6bd6293b
Author: Vladislav Tabolin <tabolin@yandex.ru>
Date:   Tue Nov 28 23:05:30 2023 +0300

    opensearch tf provider hash func fix
  • Loading branch information
Vladislav Tabolin committed Nov 29, 2023
1 parent 78002e5 commit 4ea9e8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions yandex/mdb_opensearch_structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ func openSearchRoleHash(v interface{}) int {
}

func setHash(set *schema.Set) int {
var hashCode int = 2166136261
var hashCode int = -2128831035
for _, v := range set.List() {
hashCode = (hashCode * 16777619) ^ hashcode.String(v.(string))
}
return hashCode
}

func upperCaseStringSetHash(set *schema.Set) int {
var hashCode int = 2166136261
var hashCode int = -2128831035
for _, v := range set.List() {
hashCode = (hashCode * 16777619) ^ hashcode.String(strings.ToUpper(v.(string)))
}
Expand All @@ -347,7 +347,7 @@ func openSearchResourcesHash(v *schema.Set) int {
return 0
}
resources := v.List()[0].(map[string]interface{})
var hashCode int = 2166136261
var hashCode int = -2128831035
hashCode += (hashCode * 16777619) ^ hashcode.String(resources["resource_preset_id"].(string))
hashCode += (hashCode * 16777619) ^ schema.HashInt(resources["disk_size"].(int))
hashCode += (hashCode * 16777619) ^ hashcode.String(resources["disk_type_id"].(string))
Expand All @@ -360,7 +360,7 @@ func openSearchResourcesHash(v *schema.Set) int {
func openSearchNodeGroupDeepHash(v interface{}) int {
group := v.(map[string]interface{})

var hashCode int = 2166136261
var hashCode int = -2128831035
hashCode = (hashCode * 16777619) ^ hashcode.String(group["name"].(string))
resources := group["resources"]
if resources != nil {
Expand Down

0 comments on commit 4ea9e8d

Please sign in to comment.