Skip to content

Commit 9db20ba

Browse files
Only set enabled bool if evaluation mode is unspecified (#9629) (#6785)
* Only set enabled bool if evaluation mode is unspecified * Only trigger one cluster update event if both both legacy and struct blocks have diffs. * remove inadvertant modifications * Pass legacy bool to expandBinaryAuthorization fn * move fn for diff readability * reformat * reformat * Only get enable_binary_authorization if its been changed * remove commas * fix logic * Remove enable_binary_authorization condition * Add upgrade path docs * Add comma * Update mmv1/third_party/terraform/website/docs/guides/version_5_upgrade.html.markdown --------- [upstream:c1e45b10619f22ab5dff5d29f5b429a787389f45] Signed-off-by: Modular Magician <[email protected]>
1 parent d50dd59 commit 9db20ba

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

.changelog/9629.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
container: fixed an issue in which migrating from the deprecated Binauthz enablement bool to the new evaluation mode enum inadvertently caused two cluster update events, instead of none.
3+
```

google-beta/services/container/resource_container_cluster.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,26 +2991,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
29912991
log.Printf("[INFO] GKE cluster %s's autopilot workload policy config allow_net_admin has been set to %v", d.Id(), allowed)
29922992
}
29932993

2994-
if d.HasChange("enable_binary_authorization") {
2995-
enabled := d.Get("enable_binary_authorization").(bool)
2996-
req := &container.UpdateClusterRequest{
2997-
Update: &container.ClusterUpdate{
2998-
DesiredBinaryAuthorization: &container.BinaryAuthorization{
2999-
Enabled: enabled,
3000-
ForceSendFields: []string{"Enabled"},
3001-
},
3002-
},
3003-
}
3004-
3005-
updateF := updateFunc(req, "updating GKE binary authorization")
3006-
// Call update serially.
3007-
if err := transport_tpg.LockedCall(lockKey, updateF); err != nil {
3008-
return err
3009-
}
3010-
3011-
log.Printf("[INFO] GKE cluster %s's binary authorization has been updated to %v", d.Id(), enabled)
3012-
}
3013-
30142994
if d.HasChange("private_cluster_config.0.enable_private_endpoint") {
30152995
enabled := d.Get("private_cluster_config.0.enable_private_endpoint").(bool)
30162996
req := &container.UpdateClusterRequest{

website/docs/guides/version_5_upgrade.html.markdown

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,15 @@ resource "google_container_cluster" "primary" {
636636

637637
### `enable_binary_authorization` is now removed
638638

639-
`enable_binary_authorization` has been removed in favor of `binary_authorization.enabled`.
639+
`enable_binary_authorization` has been removed in favor of `binary_authorization.evaluation_mode`.
640+
To enable Binary Authorization, set evaluation mode to "PROJECT_SINGLETON_POLICY_ENFORCE"
641+
as shown in the example below. To disable it, set evaluation mode to "DISABLED".
642+
643+
```
644+
binary_authorization {
645+
evaluation_mode = "PROJECT_SINGLETON_POLICY_ENFORCE"
646+
}
647+
```
640648

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

0 commit comments

Comments
 (0)