Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only set enabled bool if evaluation mode is unspecified #9629

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -2988,26 +2988,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
log.Printf("[INFO] GKE cluster %s's autopilot workload policy config allow_net_admin has been set to %v", d.Id(), allowed)
}

if d.HasChange("enable_binary_authorization") {
enabled := d.Get("enable_binary_authorization").(bool)
req := &container.UpdateClusterRequest{
Update: &container.ClusterUpdate{
DesiredBinaryAuthorization: &container.BinaryAuthorization{
Enabled: enabled,
ForceSendFields: []string{"Enabled"},
},
},
}

updateF := updateFunc(req, "updating GKE binary authorization")
// Call update serially.
if err := transport_tpg.LockedCall(lockKey, updateF); err != nil {
return err
}

log.Printf("[INFO] GKE cluster %s's binary authorization has been updated to %v", d.Id(), enabled)
}

if d.HasChange("private_cluster_config.0.enable_private_endpoint") {
enabled := d.Get("private_cluster_config.0.enable_private_endpoint").(bool)
req := &container.UpdateClusterRequest{
Expand Down Expand Up @@ -3046,7 +3026,7 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
log.Printf("[INFO] GKE cluster %s's master global access config has been updated to %v", d.Id(), config)
}

if d.HasChange("binary_authorization") {
if d.HasChange("binary_authorization") {
req := &container.UpdateClusterRequest{
Update: &container.ClusterUpdate{
DesiredBinaryAuthorization: expandBinaryAuthorization(d.Get("binary_authorization")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,15 @@ resource "google_container_cluster" "primary" {

### `enable_binary_authorization` is now removed

`enable_binary_authorization` has been removed in favor of `binary_authorization.enabled`.
`enable_binary_authorization` has been removed in favor of `binary_authorization.evaluation_mode`.
To enable Binary Authorization set evaluation mode to "PROJECT_SINGLETON_POLICY_ENFORCE"
as shown in the example below, to disable it, set evaluation mode to "DISABLED".
melinath marked this conversation as resolved.
Show resolved Hide resolved

```
binary_authorization {
evaluation_mode = "PROJECT_SINGLETON_POLICY_ENFORCE"
}
```

### Default value of `network_policy.provider` is now removed

Expand Down