Skip to content

Commit 90bab07

Browse files
Only set enabled bool if evaluation mode is unspecified (#9629) (#16851)
* 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 9981d0b commit 90bab07

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

.changelog/9629.txt

+3
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/services/container/resource_container_cluster.go

-20
Original file line numberDiff line numberDiff line change
@@ -2770,26 +2770,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
27702770
log.Printf("[INFO] GKE cluster %s's autopilot workload policy config allow_net_admin has been set to %v", d.Id(), allowed)
27712771
}
27722772

2773-
if d.HasChange("enable_binary_authorization") {
2774-
enabled := d.Get("enable_binary_authorization").(bool)
2775-
req := &container.UpdateClusterRequest{
2776-
Update: &container.ClusterUpdate{
2777-
DesiredBinaryAuthorization: &container.BinaryAuthorization{
2778-
Enabled: enabled,
2779-
ForceSendFields: []string{"Enabled"},
2780-
},
2781-
},
2782-
}
2783-
2784-
updateF := updateFunc(req, "updating GKE binary authorization")
2785-
// Call update serially.
2786-
if err := transport_tpg.LockedCall(lockKey, updateF); err != nil {
2787-
return err
2788-
}
2789-
2790-
log.Printf("[INFO] GKE cluster %s's binary authorization has been updated to %v", d.Id(), enabled)
2791-
}
2792-
27932773
if d.HasChange("private_cluster_config.0.enable_private_endpoint") {
27942774
enabled := d.Get("private_cluster_config.0.enable_private_endpoint").(bool)
27952775
req := &container.UpdateClusterRequest{

website/docs/guides/version_5_upgrade.html.markdown

+9-1
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)