Skip to content

Commit dc63353

Browse files
google_compute_security_policy: force send enforce_on_key so it can be unset on (#7454) (#13993)
Signed-off-by: Modular Magician <[email protected]>
1 parent f6e50be commit dc63353

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

.changelog/7454.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
compute: fixed bug where `enforce_on_key_name` could not be unset on `google_compute_security_policy`
3+
```

google/resource_compute_security_policy.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,7 @@ func expandSecurityPolicyRuleRateLimitOptions(configured []interface{}) *compute
961961
EnforceOnKeyName: data["enforce_on_key_name"].(string),
962962
BanDurationSec: int64(data["ban_duration_sec"].(int)),
963963
ExceedRedirectOptions: expandSecurityPolicyRuleRedirectOptions(data["exceed_redirect_options"].([]interface{})),
964+
ForceSendFields: []string{"EnforceOnKey", "EnforceOnKeyName"},
964965
}
965966
}
966967

@@ -982,13 +983,12 @@ func flattenSecurityPolicyRuleRateLimitOptions(conf *compute.SecurityPolicyRuleR
982983
}
983984

984985
data := map[string]interface{}{
985-
"ban_threshold": flattenThreshold(conf.BanThreshold),
986-
"rate_limit_threshold": flattenThreshold(conf.RateLimitThreshold),
987-
"exceed_action": conf.ExceedAction,
988-
"conform_action": conf.ConformAction,
989-
"enforce_on_key": conf.EnforceOnKey,
990-
"enforce_on_key_name": conf.EnforceOnKeyName,
991-
986+
"ban_threshold": flattenThreshold(conf.BanThreshold),
987+
"rate_limit_threshold": flattenThreshold(conf.RateLimitThreshold),
988+
"exceed_action": conf.ExceedAction,
989+
"conform_action": conf.ConformAction,
990+
"enforce_on_key": conf.EnforceOnKey,
991+
"enforce_on_key_name": conf.EnforceOnKeyName,
992992
"ban_duration_sec": conf.BanDurationSec,
993993
"exceed_redirect_options": flattenSecurityPolicyRedirectOptions(conf.ExceedRedirectOptions),
994994
}

0 commit comments

Comments
 (0)