Skip to content

Instantly share code, notes, and snippets.

@tormath1
Created December 11, 2020 17:47
Show Gist options
  • Save tormath1/09403c0a9b199400e9d203da034885b7 to your computer and use it in GitHub Desktop.
Save tormath1/09403c0a9b199400e9d203da034885b7 to your computer and use it in GitHub Desktop.
resource "google_container_cluster" "primary" {
name = "cluster-lab"
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
master_auth {
username = ""
password = ""
client_certificate_config {
issue_client_certificate = false
}
}
}
resource "google_container_node_pool" "nodes" {
name = "node-pool-lab"
location = "us-central1"
cluster = google_container_cluster.primary.name
node_count = 1
node_config {
preemptible = true
machine_type = "e2-medium"
metadata = {
disable-legacy-endpoints = "true"
}
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform"
]
labels = {
env = "lab"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment