Skip to content

Commit

Permalink
Cluster authenticator groups ga (#2739)
Browse files Browse the repository at this point in the history
Merged PR #2739.
  • Loading branch information
slevenick authored and modular-magician committed Nov 22, 2019
1 parent 35abeef commit a6681b9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
14 changes: 4 additions & 10 deletions third_party/terraform/resources/resource_container_cluster.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func resourceContainerCluster() *schema.Resource {
Optional: true,
Default: false,
},
<% end -%>

"authenticator_groups_config": {
Type: schema.TypeList,
Expand All @@ -396,7 +397,6 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
<% end -%>

"initial_node_count": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -1091,11 +1091,9 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
cluster.NodeConfig = expandNodeConfig(v)
}

<% unless version == 'ga' -%>
if v, ok := d.GetOk("authenticator_groups_config"); ok {
cluster.AuthenticatorGroupsConfig = expandAuthenticatorGroupsConfig(v)
}
<% end -%>

if v, ok := d.GetOk("private_cluster_config"); ok {
cluster.PrivateClusterConfig = expandPrivateClusterConfig(v)
Expand Down Expand Up @@ -1252,9 +1250,6 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
if err := d.Set("cluster_autoscaling", flattenClusterAutoscaling(cluster.Autoscaling)); err != nil {
return err
}
if err := d.Set("authenticator_groups_config", flattenAuthenticatorGroupsConfig(cluster.AuthenticatorGroupsConfig)); err != nil {
return err
}
if err := d.Set("release_channel", flattenReleaseChannel(cluster.ReleaseChannel)); err != nil {
return err
}
Expand All @@ -1264,6 +1259,9 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
return err
}
<% end -%>
if err := d.Set("authenticator_groups_config", flattenAuthenticatorGroupsConfig(cluster.AuthenticatorGroupsConfig)); err != nil {
return err
}
if cluster.DefaultMaxPodsConstraint != nil {
d.Set("default_max_pods_per_node", cluster.DefaultMaxPodsConstraint.MaxPodsPerNode)
}
Expand Down Expand Up @@ -2281,7 +2279,6 @@ func expandClusterAutoscaling(configured interface{}, d *schema.ResourceData) *c
}
<% end -%>

<% unless version == 'ga' -%>
func expandAuthenticatorGroupsConfig(configured interface{}) *containerBeta.AuthenticatorGroupsConfig {
l := configured.([]interface{})
if len(l) == 0 {
Expand All @@ -2295,7 +2292,6 @@ func expandAuthenticatorGroupsConfig(configured interface{}) *containerBeta.Auth
}
return result
}
<% end -%>

func expandMasterAuth(configured interface{}) *containerBeta.MasterAuth {
l := configured.([]interface{})
Expand Down Expand Up @@ -2560,7 +2556,6 @@ func flattenClusterNodePools(d *schema.ResourceData, config *Config, c []*contai
return nodePools, nil
}

<% unless version == 'ga' -%>
func flattenAuthenticatorGroupsConfig(c *containerBeta.AuthenticatorGroupsConfig) []map[string]interface{} {
if c == nil {
return nil
Expand All @@ -2571,7 +2566,6 @@ func flattenAuthenticatorGroupsConfig(c *containerBeta.AuthenticatorGroupsConfig
},
}
}
<% end -%>

func flattenPrivateClusterConfig(c *containerBeta.PrivateClusterConfig) []map[string]interface{} {
if c == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ func TestAccContainerCluster_withMasterAuthConfig_NoCert(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) {
t.Parallel()
clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10))
Expand All @@ -216,7 +215,6 @@ func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) {
},
})
}
<% end -%>

func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -1961,7 +1959,6 @@ resource "google_container_cluster" "with_network_policy_enabled" {
`, clusterName)
}

<% unless version == 'ga' -%>
func testAccContainerCluster_withAuthenticatorGroupsConfig(clusterName string) string {
return fmt.Sprintf(`
resource "google_compute_network" "container_network" {
Expand Down Expand Up @@ -2005,7 +2002,6 @@ resource "google_container_cluster" "with_authenticator_groups" {
}
`, clusterName, clusterName)
}
<% end -%>

func testAccContainerCluster_withMasterAuthorizedNetworksConfig(clusterName string, cidrs []string, emptyValue string) string {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ region are guaranteed to support the same version.
[PodSecurityPolicy](https://cloud.google.com/kubernetes-engine/docs/how-to/pod-security-policies) feature.
Structure is documented below.

* `authenticator_groups_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Configuration for the
* `authenticator_groups_config` - (Optional) Configuration for the
[Google Groups for GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control#groups-setup-gsuite) feature.
Structure is documented below.

Expand Down

0 comments on commit a6681b9

Please sign in to comment.