From e15b98e0c31093aafbedd436bd31db56056571d8 Mon Sep 17 00:00:00 2001 From: Nicholas Eberts Date: Tue, 15 Oct 2024 20:03:44 -0400 Subject: [PATCH] added IPs and endpoints for whereami and inference apps --- terraform/modules/clusters/main.tf | 85 +++++++++++++++--------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/terraform/modules/clusters/main.tf b/terraform/modules/clusters/main.tf index eafe5175..c5cb1997 100644 --- a/terraform/modules/clusters/main.tf +++ b/terraform/modules/clusters/main.tf @@ -22,59 +22,58 @@ data "google_project" "project" { locals { // Presets for project and network settings project_id = var.shared_vpc ? var.vpc_project_id : var.project_id - network_name = var.vpc_name + # network_name = var.vpc_name network = "projects/${local.project_id}/global/networks/${var.vpc_name}" - vpc_selflink = format("projects/%s/global/networks/%s", local.project_id, local.network_name) - ip_range_pods = var.vpc_ip_range_pods_name - ip_range_services = var.vpc_ip_range_services_name - distinct_cluster_regions = toset([for cluster in var.cluster_config : "${cluster.region}"]) + vpc_selflink = format("projects/%s/global/networks/%s", local.project_id, var.vpc_name) + # ip_range_pods = var.vpc_ip_range_pods_name + # ip_range_services = var.vpc_ip_range_services_name + # distinct_cluster_regions = toset([for cluster in var.cluster_config : "${cluster.region}"]) // Dynamically create subnet and secondary subnet inputs for multi-cluster creation - nested_subnets = flatten([ - for name, config in var.cluster_config : [ - { - subnet_name = config.subnet_name - subnet_ip = "10.0.${index(keys(var.cluster_config), name)}.0/24" - subnet_region = config.region - subnet_private_access = true - description = "This subnet is managed by Terraform" - } - ] - ]) + # nested_subnets = flatten([ + # for name, config in var.cluster_config : [ + # { + # subnet_name = config.subnet_name + # subnet_region = config.region + # subnet_private_access = true + # description = "This subnet is managed by Terraform" + # } + # ] + # ]) - nested_secondary_subnets = { - for name, config in var.cluster_config : config.subnet_name => [ - { - range_name = local.ip_range_pods - ip_cidr_range = "10.${index(keys(var.cluster_config), name) + 1}.0.0/17" - }, - { - range_name = local.ip_range_services - ip_cidr_range = "10.${index(keys(var.cluster_config), name) + 1}.128.0/17" - } - ] - } + # nested_secondary_subnets = { + # for name, config in var.cluster_config : config.subnet_name => [ + # { + # range_name = local.ip_range_pods + # ip_cidr_range = "10.${index(keys(var.cluster_config), name) + 1}.0.0/17" + # }, + # { + # range_name = local.ip_range_services + # ip_cidr_range = "10.${index(keys(var.cluster_config), name) + 1}.128.0/17" + # } + # ] + # } # subnetworks_to_nat = flatten([ for cluster in var.cluster_config : [{ "name" = cluster.subnet_name, "source_ip_ranges_to_nat" = ["PRIMARY_IP_RANGE"], "secondary_ip_range_names" = [] }] ]) // Presets for Linux Node Pool - linux_pool = [{ - name = format("linux-%s", var.node_pool) - initial_node_count = var.initial_node_count - total_min_count = 0 - total_max_count = 20 - auto_upgrade = true - auto_repair = true - node_metadata = "GKE_METADATA" - machine_type = var.linux_machine_type - disk_type = "pd-balanced" - disk_size_gb = 200 - image_type = "COS_CONTAINERD" - enable_secure_boot = true - }] + # linux_pool = [{ + # name = format("linux-%s", var.node_pool) + # initial_node_count = var.initial_node_count + # total_min_count = 0 + # total_max_count = 20 + # auto_upgrade = true + # auto_repair = true + # node_metadata = "GKE_METADATA" + # machine_type = var.linux_machine_type + # disk_type = "pd-balanced" + # disk_size_gb = 200 + # image_type = "COS_CONTAINERD" + # enable_secure_boot = true + # }] // Final Node Pool options for Cluster - combines all specified nodepools - cluster_node_pool = flatten(local.linux_pool) + # cluster_node_pool = flatten(local.linux_pool) }