diff --git a/.changelog/3942.txt b/.changelog/3942.txt new file mode 100644 index 00000000000..6f98a3d8045 --- /dev/null +++ b/.changelog/3942.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +Added self_link to google_container_cluster +``` diff --git a/google/resource_container_cluster.go b/google/resource_container_cluster.go index 7a416411a0b..8e5f80bd7d8 100644 --- a/google/resource_container_cluster.go +++ b/google/resource_container_cluster.go @@ -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, @@ -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"), } @@ -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 } @@ -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 } diff --git a/google/resource_container_cluster_test.go b/google/resource_container_cluster_test.go index 5718479714c..a28ddbe405a 100644 --- a/google/resource_container_cluster_test.go +++ b/google/resource_container_cluster_test.go @@ -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"), ), }, { @@ -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" diff --git a/website/docs/r/container_cluster.html.markdown b/website/docs/r/container_cluster.html.markdown index 12660aebd10..e0028cb5739 100644 --- a/website/docs/r/container_cluster.html.markdown +++ b/website/docs/r/container_cluster.html.markdown @@ -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) @@ -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. @@ -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. @@ -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: @@ -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