Last active
July 18, 2021 06:53
-
-
Save bharatmicrosystems/fc630cb5bbe69a06553c73eec9a3eb11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "google" { | |
project = var.project_id | |
region = var.region | |
zone = var.location | |
} | |
resource "google_service_account" "main" { | |
account_id = "${var.cluster_name}-sa" | |
display_name = "GKE Cluster ${var.cluster_name} Service Account" | |
} | |
resource "google_container_cluster" "main" { | |
name = "${var.cluster_name}" | |
location = var.location | |
initial_node_count = 3 | |
node_config { | |
service_account = google_service_account.main.email | |
oauth_scopes = [ | |
"https://www.googleapis.com/auth/cloud-platform" | |
] | |
} | |
timeouts { | |
create = "30m" | |
update = "40m" | |
} | |
} | |
resource "time_sleep" "wait_30_seconds" { | |
depends_on = [google_container_cluster.main] | |
create_duration = "30s" | |
} | |
module "gke_auth" { | |
depends_on = [time_sleep.wait_30_seconds] | |
source = "terraform-google-modules/kubernetes-engine/google//modules/auth" | |
project_id = var.project_id | |
cluster_name = google_container_cluster.main.name | |
location = var.location | |
use_private_endpoint = false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment