From 381f22ff78225f37e129ac9fac02528925732434 Mon Sep 17 00:00:00 2001 From: Paddy Date: Mon, 3 Jun 2019 16:08:55 -0700 Subject: [PATCH] Add top-level services_ipv4_cidr attr to container_cluster. (#1873) Merged PR #1873. --- build/terraform | 2 +- build/terraform-beta | 2 +- .../terraform/resources/resource_container_cluster.go.erb | 6 ++++++ .../terraform/tests/resource_container_cluster_test.go.erb | 3 +++ .../website/docs/r/container_cluster.html.markdown | 5 +++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build/terraform b/build/terraform index 3199d149cb17..a33eca08d2e3 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit 3199d149cb17ad06a2df65e113a2a3c1a83acf21 +Subproject commit a33eca08d2e3781c615e165ca6d88012b0c0224a diff --git a/build/terraform-beta b/build/terraform-beta index 570cc443ab4d..de2b8ddffca1 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit 570cc443ab4da78282c7d37a8ecb38a4afad6cc1 +Subproject commit de2b8ddffca12c3110889c2bafe72b36b7a0f9d8 diff --git a/third_party/terraform/resources/resource_container_cluster.go.erb b/third_party/terraform/resources/resource_container_cluster.go.erb index d364956e9db5..358216595b44 100644 --- a/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/third_party/terraform/resources/resource_container_cluster.go.erb @@ -554,6 +554,11 @@ func resourceContainerCluster() *schema.Resource { Computed: true, }, + "services_ipv4_cidr": { + Type: schema.TypeString, + Computed: true, + }, + "ip_allocation_policy": { Type: schema.TypeList, MaxItems: 1, @@ -1034,6 +1039,7 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro d.Set("master_version", cluster.CurrentMasterVersion) d.Set("node_version", cluster.CurrentNodeVersion) d.Set("cluster_ipv4_cidr", cluster.ClusterIpv4Cidr) + d.Set("services_ipv4_cidr", cluster.ServicesIpv4Cidr) d.Set("description", cluster.Description) d.Set("enable_kubernetes_alpha", cluster.EnableKubernetesAlpha) d.Set("enable_legacy_abac", cluster.LegacyAbac.Enabled) 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 0ec6d2bf64c1..76536d94a6f0 100644 --- a/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -88,6 +88,9 @@ func TestAccContainerCluster_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccContainerCluster_basic(clusterName), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttrSet("google_container_cluster.primary", "services_ipv4_cidr"), + ), }, { ResourceName: "google_container_cluster.primary", 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 adf286e8e29b..48dc2b3231fe 100644 --- a/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -607,6 +607,11 @@ exported: [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `1.2.3.4/29`). +* `services_ipv4_cidr` - The IP address range of the Kubernetes services in this + cluster, in [CIDR](http:en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) + notation (e.g. `1.2.3.4/29`). Service addresses are typically put in the last + `/16` from the container CIDR. + ## Timeouts