From a6681b907392f01a0081298f08a258124531774b Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Fri, 22 Nov 2019 10:41:19 -0800 Subject: [PATCH] Cluster authenticator groups ga (#2739) Merged PR #2739. --- build/terraform | 2 +- build/terraform-beta | 2 +- .../resources/resource_container_cluster.go.erb | 14 ++++---------- .../tests/resource_container_cluster_test.go.erb | 4 ---- .../website/docs/r/container_cluster.html.markdown | 2 +- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/build/terraform b/build/terraform index 87cc23d350e5..b9b0b099fde8 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit 87cc23d350e5696d18f5b48228c374f5d76e0296 +Subproject commit b9b0b099fde8e4ff807d2acfd13cb8bd2ecb9f30 diff --git a/build/terraform-beta b/build/terraform-beta index ba205574f1c3..e15dd93ec650 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit ba205574f1c335ed7e4f21e09a4ec6e28a8f1e00 +Subproject commit e15dd93ec650db20c8d1b269c2ea045819e96710 diff --git a/third_party/terraform/resources/resource_container_cluster.go.erb b/third_party/terraform/resources/resource_container_cluster.go.erb index 0cf3342d9c5e..3cef6da6644b 100644 --- a/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/third_party/terraform/resources/resource_container_cluster.go.erb @@ -379,6 +379,7 @@ func resourceContainerCluster() *schema.Resource { Optional: true, Default: false, }, +<% end -%> "authenticator_groups_config": { Type: schema.TypeList, @@ -396,7 +397,6 @@ func resourceContainerCluster() *schema.Resource { }, }, }, -<% end -%> "initial_node_count": { Type: schema.TypeInt, @@ -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) @@ -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 } @@ -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) } @@ -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 { @@ -2295,7 +2292,6 @@ func expandAuthenticatorGroupsConfig(configured interface{}) *containerBeta.Auth } return result } -<% end -%> func expandMasterAuth(configured interface{}) *containerBeta.MasterAuth { l := configured.([]interface{}) @@ -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 @@ -2571,7 +2566,6 @@ func flattenAuthenticatorGroupsConfig(c *containerBeta.AuthenticatorGroupsConfig }, } } -<% end -%> func flattenPrivateClusterConfig(c *containerBeta.PrivateClusterConfig) []map[string]interface{} { if c == nil { diff --git a/third_party/terraform/tests/resource_container_cluster_test.go.erb b/third_party/terraform/tests/resource_container_cluster_test.go.erb index f74a52afdebc..c4e3f703a7f6 100644 --- a/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -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)) @@ -216,7 +215,6 @@ func TestAccContainerCluster_withAuthenticatorGroupsConfig(t *testing.T) { }, }) } -<% end -%> func TestAccContainerCluster_withNetworkPolicyEnabled(t *testing.T) { t.Parallel() @@ -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" { @@ -2005,7 +2002,6 @@ resource "google_container_cluster" "with_authenticator_groups" { } `, clusterName, clusterName) } -<% end -%> func testAccContainerCluster_withMasterAuthorizedNetworksConfig(clusterName string, cidrs []string, emptyValue string) string { diff --git a/third_party/terraform/website/docs/r/container_cluster.html.markdown b/third_party/terraform/website/docs/r/container_cluster.html.markdown index c5e523026669..c35b0a0913d9 100644 --- a/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -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.