Skip to content

Commit edc06db

Browse files
sl1pm4tdanawillow
authored andcommitted
New datasource: google_container_cluster (hashicorp#740)
* Add google_kubernetes_cluster datasource Add documentation for google_kubernetes_cluster datasource Rename datasource to google_container_cluster To be consistent with the equivalent resource. Rename datasource in docs. google_kubernetes_cluster -> google_container_cluster. Also add reference in google.erb file. WIP Datasource read needs to set an ID, then call resource read func Add additional cluster attributes to datasource schema * Generate datasource schema from resource Datasource documentation also updated. * add test for datasourceSchemaFromResourceSchema * Code review changes
1 parent 784cb11 commit edc06db

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
layout: "google"
3+
page_title: "Google: google_container_cluster"
4+
sidebar_current: "docs-google-datasource-container-cluster"
5+
description: |-
6+
Get info about a Google Kubernetes cluster.
7+
---
8+
9+
# google\_container\_cluster
10+
11+
Get info about a cluster within GKE from its name and zone.
12+
13+
## Example Usage
14+
15+
```tf
16+
data "google_container_cluster" "my_cluster" {
17+
name = "my-cluster"
18+
zone = "us-east1-a"
19+
}
20+
21+
output "cluster_username" {
22+
value = "${data.google_container_cluster.my_cluster.master_auth.0.username}"
23+
}
24+
25+
output "cluster_password" {
26+
value = "${data.google_container_cluster.my_cluster.master_auth.0.password}"
27+
}
28+
29+
output "endpoint" {
30+
value = "${data.google_container_cluster.my_cluster.endpoint}"
31+
}
32+
33+
output "instance_group_urls" {
34+
value = "${data.google_container_cluster.my_cluster.instance_group_urls}"
35+
}
36+
37+
output "node_config" {
38+
value = "${data.google_container_cluster.my_cluster.node_config}"
39+
}
40+
41+
output "node_pools" {
42+
value = "${data.google_container_cluster.my_cluster.node_pool}"
43+
}
44+
```
45+
46+
## Argument Reference
47+
48+
The following arguments are supported:
49+
50+
* `name` - The name of the cluster.
51+
52+
* `zone` - The zones this cluster has been created in.
53+
54+
- - -
55+
56+
* `project` - (Optional) The project in which the resource belongs. If it
57+
is not provided, the provider project is used.
58+
59+
## Attributes Reference
60+
61+
See [google_container_cluster](https://www.terraform.io/docs/providers/google/r/container_cluster.html) resource for details of the available attributes.

google.erb

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<li<%= sidebar_current("docs-google-datasource-compute-lb-ip-ranges") %>>
4444
<a href="/docs/providers/google/d/datasource_compute_lb_ip_ranges.html">google_compute_lb_ip_ranges</a>
4545
</li>
46+
<li<%= sidebar_current("docs-google-datasource-container-cluster") %>>
47+
<a href="/docs/providers/google/d/google_container_cluster.html">google_container_cluster</a>
48+
</li>
4649
<li<%= sidebar_current("docs-google-datasource-container-versions") %>>
4750
<a href="/docs/providers/google/d/google_container_engine_versions.html">google_container_engine_versions</a>
4851
</li>

0 commit comments

Comments
 (0)