Skip to content

Commit

Permalink
Add top-level services_ipv4_cidr attr to container_cluster.
Browse files Browse the repository at this point in the history
There's a computed, output-only services_ipv4_cidr attribute for
GKE Clusters that we're currently not populating. This PR adds support
for them. See #3770.

=== RUN   TestAccContainerCluster_basic
=== PAUSE TestAccContainerCluster_basic
=== CONT  TestAccContainerCluster_basic
--- PASS: TestAccContainerCluster_basic (469.76s)
PASS
ok      github.com/terraform-providers/terraform-provider-google/google 469.775s
  • Loading branch information
paddycarver committed Jun 3, 2019
1 parent 989330c commit 9c2ba3c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<a id="timeouts"></a>
## Timeouts

Expand Down

0 comments on commit 9c2ba3c

Please sign in to comment.