Skip to content

Commit 4d1ac0d

Browse files
Fixed not being able to update preview status in SecurityPolicyRule and RegionSecurityPolicyRule (#13360) (#21984)
[upstream:70b6472fd53f87291cf3c8e58c3cada07c6aa98b] Signed-off-by: Modular Magician <[email protected]>
1 parent d93f16b commit 4d1ac0d

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.changelog/13360.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:bug
2+
compute: fixed unable to update the `preview` field for `google_compute_security_policy_rule` resource
3+
```
4+
```release-note:bug
5+
compute: fixed unable to update the `preview` field for `google_compute_region_security_policy_rule` resource (beta)
6+
```

google/services/compute/resource_compute_security_policy_rule.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ func resourceComputeSecurityPolicyRuleCreate(d *schema.ResourceData, meta interf
594594
previewProp, err := expandComputeSecurityPolicyRulePreview(d.Get("preview"), d, config)
595595
if err != nil {
596596
return err
597-
} else if v, ok := d.GetOkExists("preview"); !tpgresource.IsEmptyValue(reflect.ValueOf(previewProp)) && (ok || !reflect.DeepEqual(v, previewProp)) {
597+
} else if v, ok := d.GetOkExists("preview"); ok || !reflect.DeepEqual(v, previewProp) {
598598
obj["preview"] = previewProp
599599
}
600600

@@ -805,7 +805,7 @@ func resourceComputeSecurityPolicyRuleUpdate(d *schema.ResourceData, meta interf
805805
previewProp, err := expandComputeSecurityPolicyRulePreview(d.Get("preview"), d, config)
806806
if err != nil {
807807
return err
808-
} else if v, ok := d.GetOkExists("preview"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, previewProp)) {
808+
} else if v, ok := d.GetOkExists("preview"); ok || !reflect.DeepEqual(v, previewProp) {
809809
obj["preview"] = previewProp
810810
}
811811

google/services/compute/resource_compute_security_policy_rule_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ func TestAccComputeSecurityPolicyRule_basicUpdate(t *testing.T) {
3939
ImportState: true,
4040
ImportStateVerify: true,
4141
},
42+
{
43+
Config: testAccComputeSecurityPolicyRule_preBasicUpdate(context),
44+
},
45+
{
46+
ResourceName: "google_compute_security_policy_rule.policy_rule",
47+
ImportState: true,
48+
ImportStateVerify: true,
49+
},
4250
},
4351
})
4452
}

0 commit comments

Comments
 (0)