Skip to content

Commit

Permalink
[resource_container_cluster] - Add self-link property (#3942) (#7191)
Browse files Browse the repository at this point in the history
* [resource_container_cluster] - Add self-link property

* add comma to property definition

* Added documentation reference

* extend existing test with output property validation

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 3, 2020
1 parent 2845d75 commit 7eba878
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/3942.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Added self_link to google_container_cluster
```
9 changes: 7 additions & 2 deletions google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,12 @@ func resourceContainerCluster() *schema.Resource {
Description: `The name or self_link of the Google Compute Engine subnetwork in which the cluster's instances are launched.`,
},

"self_link": {
Type: schema.TypeString,
Computed: true,
Description: `Server-defined URL for the resource.`,
},

"endpoint": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -1076,7 +1082,6 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
ForceSendFields: []string{"Enabled"},
},
ReleaseChannel: expandReleaseChannel(d.Get("release_channel")),

MasterAuth: expandMasterAuth(d.Get("master_auth")),
ResourceLabels: expandStringMap(d, "resource_labels"),
}
Expand Down Expand Up @@ -1320,6 +1325,7 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
d.Set("node_locations", locations)

d.Set("endpoint", cluster.Endpoint)
d.Set("self_link", cluster.SelfLink)
if err := d.Set("maintenance_policy", flattenMaintenancePolicy(cluster.MaintenancePolicy)); err != nil {
return err
}
Expand Down Expand Up @@ -1351,7 +1357,6 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
if err := d.Set("release_channel", flattenReleaseChannel(cluster.ReleaseChannel)); err != nil {
return err
}

if err := d.Set("authenticator_groups_config", flattenAuthenticatorGroupsConfig(cluster.AuthenticatorGroupsConfig)); err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func TestAccContainerCluster_basic(t *testing.T) {
Config: testAccContainerCluster_basic(clusterName),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("google_container_cluster.primary", "services_ipv4_cidr"),
resource.TestCheckResourceAttrSet("google_container_cluster.primary", "self_link"),
),
},
{
Expand Down Expand Up @@ -2786,7 +2787,7 @@ func testAccContainerCluster_withResourceUsageExportConfig(clusterName, datasetI
return fmt.Sprintf(`
provider "google" {
user_project_override = true
}
}
resource "google_bigquery_dataset" "default" {
dataset_id = "%s"
description = "gke resource usage dataset tests"
Expand Down
10 changes: 6 additions & 4 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: |-

# google\_container\_cluster

-> Visit the [Provision a GKE Cluster (Google Cloud)](https://learn.hashicorp.com/tutorials/terraform/gke?in=terraform/kubernetes&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) Learn tutorial to learn how to provision and interact
-> Visit the [Provision a GKE Cluster (Google Cloud)](https://learn.hashicorp.com/tutorials/terraform/gke?in=terraform/kubernetes&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) Learn tutorial to learn how to provision and interact
with a GKE cluster.

-> See the [Using GKE with Terraform](/docs/providers/google/guides/using_gke_with_terraform.html)
Expand Down Expand Up @@ -365,7 +365,7 @@ The `addons_config` block supports:
All cluster nodes running GKE 1.15 and higher are recreated.**

* `gce_persistent_disk_csi_driver_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. Defaults to disabled; set `enabled = true` to enable.
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. Defaults to disabled; set `enabled = true` to enable.

* `kalm_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/ provider_versions.html)).
Configuration for the KALM addon, which manages the lifecycle of k8s. It is disabled by default; Set `enabled = true` to enable.
Expand Down Expand Up @@ -636,7 +636,7 @@ recommended. Structure is documented below.

* `workload_metadata_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Metadata configuration to expose to workloads on the node pool.
Structure is documented below.

* `kubelet_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
Kubelet configuration, currently supported attributes can be found [here](https://cloud.google.com/sdk/gcloud/reference/beta/container/node-pools/create#--system-config-from-file).
Structure is documented below.
Expand Down Expand Up @@ -817,7 +817,7 @@ The `linux_node_config` block supports:

* `sysctls` - (Required) The Linux kernel parameters to be applied to the nodes
and all pods running on the nodes. Specified as a map from the key, such as
`net.core.wmem_max`, to a string value.
`net.core.wmem_max`, to a string value.

The `vertical_pod_autoscaling` block supports:

Expand All @@ -830,6 +830,8 @@ exported:

* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{zone}}/clusters/{{name}}`

* `self_link` - The server-defined URL for the resource.

* `endpoint` - The IP address of this cluster's Kubernetes master.

* `instance_group_urls` - List of instance group URLs which have been assigned
Expand Down

0 comments on commit 7eba878

Please sign in to comment.