Skip to content

Commit

Permalink
fix: reduce zones used in standalone example clusters (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsorbo authored Feb 14, 2023
1 parent 34f3ead commit 1fa43a4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions examples/standalone_single_project/gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ locals {
}
}

data "google_compute_zones" "available" {
provider = google

project = var.project_id
region = var.region
}

resource "random_shuffle" "available_zones" {
input = data.google_compute_zones.available.names
result_count = 2
}

# Private GKE Clusters
module "gke_cluster" {
for_each = toset(local.envs)
Expand All @@ -33,13 +45,15 @@ module "gke_cluster" {
name = "${var.app_name}-cluster-${each.value}"
regional = true
region = var.region
zones = sort(random_shuffle.available_zones.result)
network = module.vpc.network_name
subnetwork = local.subnets[each.value].subnet_name
ip_range_pods = "${local.subnets[each.value].subnet_name}-gke-pods"
ip_range_services = "${local.subnets[each.value].subnet_name}-gke-services"
horizontal_pod_autoscaling = true
create_service_account = true
enable_binary_authorization = true
remove_default_node_pool = true

grant_registry_access = true
registry_project_ids = [var.project_id]
Expand All @@ -66,9 +80,9 @@ module "gke_cluster" {

node_pools = [
{
name = "default-node-pool"
location_policy = "BALANCED"
initial_node_count = 2
name = "default-node-pool"
location_policy = "BALANCED"
total_max_node_count = 2
}
]

Expand Down

0 comments on commit 1fa43a4

Please sign in to comment.