Skip to content

Commit 39d210b

Browse files
cloudquotas: resolved permadiff for preferred_value in google_cloud_quotas_quota_preference (#15254)
1 parent e61590f commit 39d210b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

mmv1/products/cloudquotas/QuotaPreference.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ timeouts:
3535
update_minutes: 20
3636
delete_minutes: 20
3737
custom_code:
38+
constants: 'templates/terraform/constants/google_cloud_quotas_quota_preference.go.tmpl'
3839
examples:
3940
- name: 'cloudquotas_quota_preference_basic'
4041
primary_resource_id: 'preference'
@@ -91,6 +92,7 @@ properties:
9192
description: |
9293
The preferred value. Must be greater than or equal to -1. If set to -1, it means the value is "unlimited".
9394
required: true
95+
diff_suppress_func: 'QuotaPreferredValueDiffSuppress'
9496
- name: 'stateDetail'
9597
type: String
9698
description: Optional details about the state of this quota preference.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
func QuotaPreferredValueDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
2+
o, n := d.GetChange(k)
3+
4+
oldEmpty := o == nil || o == ""
5+
newEmpty := n == nil || n == ""
6+
7+
return (oldEmpty && n == "0") || (o == "0" && newEmpty)
8+
}

0 commit comments

Comments
 (0)