Skip to content

Commit 0cd0ff0

Browse files
committed
Use built-in schema.HashString.
1 parent 2baff8a commit 0cd0ff0

22 files changed

Lines changed: 36 additions & 120 deletions

‎builtin/providers/atlas/resource_artifact.go‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"regexp"
66

77
"github.com/hashicorp/atlas-go/v1"
8-
"github.com/hashicorp/terraform/helper/hashcode"
98
"github.com/hashicorp/terraform/helper/schema"
109
)
1110

@@ -51,9 +50,7 @@ func resourceArtifact() *schema.Resource {
5150
Optional: true,
5251
ForceNew: true,
5352
Elem: &schema.Schema{Type: schema.TypeString},
54-
Set: func(v interface{}) int {
55-
return hashcode.String(v.(string))
56-
},
53+
Set: schema.HashString,
5754
},
5855

5956
"metadata": &schema.Schema{

‎builtin/providers/aws/provider.go‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package aws
22

33
import (
4-
"github.com/hashicorp/terraform/helper/hashcode"
54
"github.com/hashicorp/terraform/helper/mutexkv"
65
"github.com/hashicorp/terraform/helper/schema"
76
"github.com/hashicorp/terraform/terraform"
@@ -73,19 +72,15 @@ func Provider() terraform.ResourceProvider {
7372
Elem: &schema.Schema{Type: schema.TypeString},
7473
Optional: true,
7574
ConflictsWith: []string{"forbidden_account_ids"},
76-
Set: func(v interface{}) int {
77-
return hashcode.String(v.(string))
78-
},
75+
Set: schema.HashString,
7976
},
8077

8178
"forbidden_account_ids": &schema.Schema{
8279
Type: schema.TypeSet,
8380
Elem: &schema.Schema{Type: schema.TypeString},
8481
Optional: true,
8582
ConflictsWith: []string{"allowed_account_ids"},
86-
Set: func(v interface{}) int {
87-
return hashcode.String(v.(string))
88-
},
83+
Set: schema.HashString,
8984
},
9085

9186
"dynamodb_endpoint": &schema.Schema{

‎builtin/providers/aws/resource_aws_cloudwatch_metric_alarm.go‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"log"
66

7-
"github.com/hashicorp/terraform/helper/hashcode"
87
"github.com/hashicorp/terraform/helper/schema"
98

109
"github.com/aws/aws-sdk-go/aws"
@@ -61,9 +60,7 @@ func resourceAwsCloudWatchMetricAlarm() *schema.Resource {
6160
Type: schema.TypeSet,
6261
Optional: true,
6362
Elem: &schema.Schema{Type: schema.TypeString},
64-
Set: func(v interface{}) int {
65-
return hashcode.String(v.(string))
66-
},
63+
Set: schema.HashString,
6764
},
6865
"alarm_description": &schema.Schema{
6966
Type: schema.TypeString,
@@ -77,17 +74,13 @@ func resourceAwsCloudWatchMetricAlarm() *schema.Resource {
7774
Type: schema.TypeSet,
7875
Optional: true,
7976
Elem: &schema.Schema{Type: schema.TypeString},
80-
Set: func(v interface{}) int {
81-
return hashcode.String(v.(string))
82-
},
77+
Set: schema.HashString,
8378
},
8479
"ok_actions": &schema.Schema{
8580
Type: schema.TypeSet,
8681
Optional: true,
8782
Elem: &schema.Schema{Type: schema.TypeString},
88-
Set: func(v interface{}) int {
89-
return hashcode.String(v.(string))
90-
},
83+
Set: schema.HashString,
9184
},
9285
"unit": &schema.Schema{
9386
Type: schema.TypeString,

‎builtin/providers/aws/resource_aws_elasticache_cluster.go‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/aws/aws-sdk-go/aws/awserr"
1212
"github.com/aws/aws-sdk-go/service/elasticache"
1313
"github.com/aws/aws-sdk-go/service/iam"
14-
"github.com/hashicorp/terraform/helper/hashcode"
1514
"github.com/hashicorp/terraform/helper/resource"
1615
"github.com/hashicorp/terraform/helper/schema"
1716
)
@@ -89,18 +88,14 @@ func resourceAwsElasticacheCluster() *schema.Resource {
8988
Computed: true,
9089
ForceNew: true,
9190
Elem: &schema.Schema{Type: schema.TypeString},
92-
Set: func(v interface{}) int {
93-
return hashcode.String(v.(string))
94-
},
91+
Set: schema.HashString,
9592
},
9693
"security_group_ids": &schema.Schema{
9794
Type: schema.TypeSet,
9895
Optional: true,
9996
Computed: true,
10097
Elem: &schema.Schema{Type: schema.TypeString},
101-
Set: func(v interface{}) int {
102-
return hashcode.String(v.(string))
103-
},
98+
Set: schema.HashString,
10499
},
105100
// Exported Attributes
106101
"cache_nodes": &schema.Schema{
@@ -142,9 +137,7 @@ func resourceAwsElasticacheCluster() *schema.Resource {
142137
Optional: true,
143138
ForceNew: true,
144139
Elem: &schema.Schema{Type: schema.TypeString},
145-
Set: func(v interface{}) int {
146-
return hashcode.String(v.(string))
147-
},
140+
Set: schema.HashString,
148141
},
149142

150143
"snapshot_window": &schema.Schema{
@@ -185,9 +178,7 @@ func resourceAwsElasticacheCluster() *schema.Resource {
185178
Optional: true,
186179
ForceNew: true,
187180
Elem: &schema.Schema{Type: schema.TypeString},
188-
Set: func(v interface{}) int {
189-
return hashcode.String(v.(string))
190-
},
181+
Set: schema.HashString,
191182
},
192183

193184
"tags": tagsSchema(),

‎builtin/providers/aws/resource_aws_elasticache_security_group.go‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/aws/aws-sdk-go/aws"
99
"github.com/aws/aws-sdk-go/aws/awserr"
1010
"github.com/aws/aws-sdk-go/service/elasticache"
11-
"github.com/hashicorp/terraform/helper/hashcode"
1211
"github.com/hashicorp/terraform/helper/resource"
1312
"github.com/hashicorp/terraform/helper/schema"
1413
)
@@ -35,9 +34,7 @@ func resourceAwsElasticacheSecurityGroup() *schema.Resource {
3534
Required: true,
3635
ForceNew: true,
3736
Elem: &schema.Schema{Type: schema.TypeString},
38-
Set: func(v interface{}) int {
39-
return hashcode.String(v.(string))
40-
},
37+
Set: schema.HashString,
4138
},
4239
},
4340
}

‎builtin/providers/aws/resource_aws_elasticache_subnet_group.go‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/aws/aws-sdk-go/aws"
1010
"github.com/aws/aws-sdk-go/aws/awserr"
1111
"github.com/aws/aws-sdk-go/service/elasticache"
12-
"github.com/hashicorp/terraform/helper/hashcode"
1312
"github.com/hashicorp/terraform/helper/resource"
1413
"github.com/hashicorp/terraform/helper/schema"
1514
)
@@ -41,9 +40,7 @@ func resourceAwsElasticacheSubnetGroup() *schema.Resource {
4140
Type: schema.TypeSet,
4241
Required: true,
4342
Elem: &schema.Schema{Type: schema.TypeString},
44-
Set: func(v interface{}) int {
45-
return hashcode.String(v.(string))
46-
},
43+
Set: schema.HashString,
4744
},
4845
},
4946
}

‎builtin/providers/aws/resource_aws_instance.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ func resourceAwsInstance() *schema.Resource {
117117
Optional: true,
118118
Computed: true,
119119
Elem: &schema.Schema{Type: schema.TypeString},
120-
Set: func(v interface{}) int {
121-
return hashcode.String(v.(string))
122-
},
120+
Set: schema.HashString,
123121
},
124122

125123
"public_dns": &schema.Schema{

‎builtin/providers/aws/resource_aws_proxy_protocol_policy.go‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/aws/aws-sdk-go/aws"
1010
"github.com/aws/aws-sdk-go/service/elb"
11-
"github.com/hashicorp/terraform/helper/hashcode"
1211
"github.com/hashicorp/terraform/helper/schema"
1312
)
1413

@@ -29,9 +28,7 @@ func resourceAwsProxyProtocolPolicy() *schema.Resource {
2928
Type: schema.TypeSet,
3029
Elem: &schema.Schema{Type: schema.TypeString},
3130
Required: true,
32-
Set: func(v interface{}) int {
33-
return hashcode.String(v.(string))
34-
},
31+
Set: schema.HashString,
3532
},
3633
},
3734
}

‎builtin/providers/aws/resource_aws_route_table.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ func resourceAwsRouteTable() *schema.Resource {
3434
Type: schema.TypeSet,
3535
Optional: true,
3636
Elem: &schema.Schema{Type: schema.TypeString},
37-
Set: func(v interface{}) int {
38-
return hashcode.String(v.(string))
39-
},
37+
Set: schema.HashString,
4038
},
4139

4240
"route": &schema.Schema{

‎builtin/providers/aws/resource_aws_security_group.go‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ func resourceAwsSecurityGroup() *schema.Resource {
106106
Type: schema.TypeSet,
107107
Optional: true,
108108
Elem: &schema.Schema{Type: schema.TypeString},
109-
Set: func(v interface{}) int {
110-
return hashcode.String(v.(string))
111-
},
109+
Set: schema.HashString,
112110
},
113111

114112
"self": &schema.Schema{
@@ -152,9 +150,7 @@ func resourceAwsSecurityGroup() *schema.Resource {
152150
Type: schema.TypeSet,
153151
Optional: true,
154152
Elem: &schema.Schema{Type: schema.TypeString},
155-
Set: func(v interface{}) int {
156-
return hashcode.String(v.(string))
157-
},
153+
Set: schema.HashString,
158154
},
159155

160156
"self": &schema.Schema{

0 commit comments

Comments
 (0)