Skip to content

Commit

Permalink
container_cluster.html.markdown: flip recommended
Browse files Browse the repository at this point in the history
don't advertise a separately managed node pool as recommended, until
hashicorp#2115
is fixed.
  • Loading branch information
flokli committed May 28, 2019
1 parent a28fcec commit bde0dda
Showing 1 changed file with 48 additions and 40 deletions.
88 changes: 48 additions & 40 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,40 @@ and [the API reference](https://cloud.google.com/kubernetes-engine/docs/referenc
passwords as well as certificate outputs will be stored in the raw state as
plaintext. [Read more about sensitive data in state](/docs/state/sensitive-data.html).

## Example Usage - with a separately managed node pool (recommended)
## Example Usage - with the default node pool (Recommended)

```hcl
resource "google_container_cluster" "primary" {
name = "my-gke-cluster"
location = "us-central1"
# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.
remove_default_node_pool = true
initial_node_count = 1
name = "marcellus-wallace"
location = "us-central1-a"
initial_node_count = 3
# Setting an empty username and password explicitly disables basic auth
master_auth {
username = ""
password = ""
}
}
resource "google_container_node_pool" "primary_preemptible_nodes" {
name = "my-node-pool"
location = "us-central1"
cluster = "${google_container_cluster.primary.name}"
node_count = 1
node_config {
preemptible = true
machine_type = "n1-standard-1"
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
metadata {
disable-legacy-endpoints = "true"
}
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
labels = {
foo = "bar"
}
tags = ["foo", "bar"]
}
timeouts {
create = "30m"
update = "40m"
}
}
Expand All @@ -72,40 +68,51 @@ output "cluster_ca_certificate" {
}
```

## Example Usage - with the default node pool
## Example Usage - with a separately managed node pool

~> **Warning:** Until
[#2114](https://github.com/terraform-providers/terraform-provider-google/issues/2115)
is resolved, this will most likely recreate the cluster on each terraform
apply! Until this is fixed, the safest alternative is to use the default node
pool provided, as described above.


```hcl
resource "google_container_cluster" "primary" {
name = "marcellus-wallace"
location = "us-central1-a"
initial_node_count = 3
name = "my-gke-cluster"
location = "us-central1"
# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.
remove_default_node_pool = true
initial_node_count = 1
# Setting an empty username and password explicitly disables basic auth
master_auth {
username = ""
password = ""
}
}
resource "google_container_node_pool" "primary_preemptible_nodes" {
name = "my-node-pool"
location = "us-central1"
cluster = "${google_container_cluster.primary.name}"
node_count = 1
node_config {
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
preemptible = true
machine_type = "n1-standard-1"
metadata {
disable-legacy-endpoints = "true"
}
labels = {
foo = "bar"
}
tags = ["foo", "bar"]
}
timeouts {
create = "30m"
update = "40m"
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}
Expand All @@ -124,6 +131,7 @@ output "cluster_ca_certificate" {
}
```


## Argument Reference

* `name` - (Required) The name of the cluster, unique within the project and
Expand Down

0 comments on commit bde0dda

Please sign in to comment.