I showed you how to create a GKE cluster with Terraform in a previous post. When I went to enable Istio, it wasn’t as simple as I thought. I ended up having to add an additional google-beta provider, along with having to add this google-beta provider within the google_container_cluster resource.

Update gkecluster/provider.tf

You can check for the latest provider version HERE.

cat provider.tf
provider "google" {
credentials = "${file("../credentials/account.json")}"
project = "YOUR_PROJECT_ID"
region = "us-west1"
}

provider "google-beta" {
version = "2.11.0"
credentials = "${file("../credentials/account.json")}"
project = "YOUR_PROJECT_ID"
region = "us-west1"
}

Initialize.

terraform init

Update gkecluster/gkecluster.tf

cat gkecluster.tf
resource "google_container_cluster" "gke-itsmetommy-cluster" {
provider = "google-beta"
name = "itsmetommy"
network = "itsmetommy"
subnetwork = "itsmetommy-default"
location = "us-west1-a"
# 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

network_policy {
enabled = true
}

maintenance_policy {
daily_maintenance_window {
start_time = "03:00"
}
}

addons_config {
istio_config {
disabled = false
auth = "AUTH_NONE"
}
}

}