-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed forceNew * updated a test * reset security_group with empty Co-authored-by: Edward Sun <[email protected]> Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Edward Sun <[email protected]>
- Loading branch information
1 parent
f45a823
commit 26a7743
Showing
3 changed files
with
80 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
container: added update support for `authenticator_groups_config` in `google_container_cluster` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -482,15 +482,13 @@ func resourceContainerCluster() *schema.Resource { | |
Type: schema.TypeList, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
MaxItems: 1, | ||
Description: `Configuration for the Google Groups for GKE feature.`, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"security_group": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
Description: `The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected].`, | ||
}, | ||
}, | ||
|
@@ -2073,6 +2071,21 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er | |
log.Printf("[INFO] GKE cluster %s Private IPv6 Google Access has been updated", d.Id()) | ||
} | ||
|
||
if d.HasChange("authenticator_groups_config") { | ||
req := &container.UpdateClusterRequest{ | ||
Update: &container.ClusterUpdate{ | ||
DesiredAuthenticatorGroupsConfig: expandContainerClusterAuthenticatorGroupsConfig(d.Get("authenticator_groups_config")), | ||
}, | ||
} | ||
updateF := updateFunc(req, "updating GKE cluster authenticator groups config") | ||
// Call update serially. | ||
if err := lockedCall(lockKey, updateF); err != nil { | ||
return err | ||
} | ||
|
||
log.Printf("[INFO] GKE cluster %s authenticator groups config has been updated", d.Id()) | ||
} | ||
|
||
if d.HasChange("default_snat_status") { | ||
req := &container.UpdateClusterRequest{ | ||
Update: &container.ClusterUpdate{ | ||
|
@@ -3366,6 +3379,18 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig | |
return mc | ||
} | ||
|
||
func expandContainerClusterAuthenticatorGroupsConfig(configured interface{}) *container.AuthenticatorGroupsConfig { | ||
l := configured.([]interface{}) | ||
if len(l) == 0 || l[0] == nil { | ||
return nil | ||
} | ||
|
||
config := l[0].(map[string]interface{}) | ||
return &container.AuthenticatorGroupsConfig{ | ||
SecurityGroup: config["security_group"].(string), | ||
} | ||
} | ||
|
||
func flattenNotificationConfig(c *container.NotificationConfig) []map[string]interface{} { | ||
if c == nil { | ||
return nil | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters