Skip to content

Commit 96e6519

Browse files
authored
Merge pull request #28789 from hashicorp/b-apigateway-rest-api
apigateway/rest_api: Improve diff handling for policies
2 parents 3ffe8e7 + 1f6156a commit 96e6519

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

.changelog/28789.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```release-note:bug
2+
resource/aws_api_gateway_rest_api: Improve refresh to avoid unnecessary diffs in `policy`
3+
```
4+
5+
```release-note:bug
6+
resource/aws_api_gateway_rest_api_policy: Improve refresh to avoid unnecessary diffs in `policy`
7+
```

internal/service/apigateway/rest_api.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ func ResourceRestAPI() *schema.Resource {
117117
Elem: &schema.Schema{Type: schema.TypeString},
118118
},
119119
"policy": {
120-
Type: schema.TypeString,
121-
Optional: true,
122-
Computed: true,
123-
ValidateFunc: validation.StringIsJSON,
124-
DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs,
120+
Type: schema.TypeString,
121+
Optional: true,
122+
Computed: true,
123+
ValidateFunc: validation.StringIsJSON,
124+
DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs,
125+
DiffSuppressOnRefresh: true,
125126
StateFunc: func(v interface{}) string {
126127
json, _ := structure.NormalizeJsonString(v)
127128
return json

internal/service/apigateway/rest_api_policy.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ func ResourceRestAPIPolicy() *schema.Resource {
3333
},
3434

3535
"policy": {
36-
Type: schema.TypeString,
37-
Required: true,
38-
ValidateFunc: validation.StringIsJSON,
39-
DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs,
36+
Type: schema.TypeString,
37+
Required: true,
38+
ValidateFunc: validation.StringIsJSON,
39+
DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs,
40+
DiffSuppressOnRefresh: true,
4041
StateFunc: func(v interface{}) string {
4142
json, _ := structure.NormalizeJsonString(v)
4243
return json

0 commit comments

Comments
 (0)