Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created June 14, 2019 19:24
Show Gist options
  • Save mlabouardy/90a1febe5d54d37c451e8f80bd1bccfe to your computer and use it in GitHub Desktop.
Save mlabouardy/90a1febe5d54d37c451e8f80bd1bccfe to your computer and use it in GitHub Desktop.
Create Google Kubernetes Engine with Terraform
resource "google_container_cluster" "cluster" {
name = "${var.environment}"
location = "${var.zone}"
remove_default_node_pool = true
initial_node_count = "${var.k8s_nodes}"
master_auth {
username = ""
password = ""
client_certificate_config {
issue_client_certificate = false
}
}
}
resource "google_container_node_pool" "pool" {
name = "k8s-node-pool-${var.environment}"
location = "${var.zone}"
cluster = "${google_container_cluster.cluster.name}"
node_count = "${var.k8s_nodes}"
node_config {
preemptible = true
machine_type = "${var.instance_type}"
metadata {
disable-legacy-endpoints = "true"
}
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment