diff --git a/cli/internal/terraform/terraform/gcp/main.tf b/cli/internal/terraform/terraform/gcp/main.tf index 6ac77d90e..7d1c2ebcd 100644 --- a/cli/internal/terraform/terraform/gcp/main.tf +++ b/cli/internal/terraform/terraform/gcp/main.tf @@ -135,19 +135,20 @@ resource "google_compute_firewall" "firewall_internal_pods" { } module "instance_group_control_plane" { - source = "./modules/instance_group" - name = local.name - role = "ControlPlane" - uid = local.uid - instance_type = var.instance_type - instance_count = var.control_plane_count - image_id = var.image_id - disk_size = var.state_disk_size - disk_type = var.state_disk_type - network = google_compute_network.vpc_network.id - subnetwork = google_compute_subnetwork.vpc_subnetwork.id - kube_env = local.kube_env - debug = var.debug + source = "./modules/instance_group" + name = local.name + role = "ControlPlane" + uid = local.uid + instance_type = var.instance_type + instance_count = var.control_plane_count + image_id = var.image_id + disk_size = var.state_disk_size + disk_type = var.state_disk_type + network = google_compute_network.vpc_network.id + subnetwork = google_compute_subnetwork.vpc_subnetwork.id + alias_ip_range_name = google_compute_subnetwork.vpc_subnetwork.secondary_ip_range[0].range_name + kube_env = local.kube_env + debug = var.debug named_ports = flatten([ { name = "kubernetes", port = local.ports_kubernetes }, { name = "bootstrapper", port = local.ports_bootstrapper }, @@ -161,21 +162,22 @@ module "instance_group_control_plane" { } module "instance_group_worker" { - source = "./modules/instance_group" - name = local.name - role = "Worker" - uid = local.uid - instance_type = var.instance_type - instance_count = var.worker_count - image_id = var.image_id - disk_size = var.state_disk_size - disk_type = var.state_disk_type - network = google_compute_network.vpc_network.id - subnetwork = google_compute_subnetwork.vpc_subnetwork.id - kube_env = local.kube_env - debug = var.debug - labels = local.labels - init_secret_hash = local.initSecretHash + source = "./modules/instance_group" + name = "${local.name}-1" + role = "Worker" + uid = local.uid + instance_type = var.instance_type + instance_count = var.worker_count + image_id = var.image_id + disk_size = var.state_disk_size + disk_type = var.state_disk_type + network = google_compute_network.vpc_network.id + subnetwork = google_compute_subnetwork.vpc_subnetwork.id + alias_ip_range_name = google_compute_subnetwork.vpc_subnetwork.secondary_ip_range[0].range_name + kube_env = local.kube_env + debug = var.debug + labels = local.labels + init_secret_hash = local.initSecretHash } resource "google_compute_global_address" "loadbalancer_ip" { diff --git a/cli/internal/terraform/terraform/gcp/modules/instance_group/main.tf b/cli/internal/terraform/terraform/gcp/modules/instance_group/main.tf index 0fea4ef17..c7171038a 100644 --- a/cli/internal/terraform/terraform/gcp/modules/instance_group/main.tf +++ b/cli/internal/terraform/terraform/gcp/modules/instance_group/main.tf @@ -52,7 +52,7 @@ resource "google_compute_instance_template" "template" { subnetwork = var.subnetwork alias_ip_range { ip_cidr_range = "/24" - subnetwork_range_name = var.name + subnetwork_range_name = var.alias_ip_range_name } } diff --git a/cli/internal/terraform/terraform/gcp/modules/instance_group/variables.tf b/cli/internal/terraform/terraform/gcp/modules/instance_group/variables.tf index 98b359eda..5b5f55e6c 100644 --- a/cli/internal/terraform/terraform/gcp/modules/instance_group/variables.tf +++ b/cli/internal/terraform/terraform/gcp/modules/instance_group/variables.tf @@ -79,3 +79,8 @@ variable "debug" { default = false description = "Enable debug mode. This will enable serial port access on the instances." } + +variable "alias_ip_range_name" { + type = string + description = "Name of the alias IP range to use." +} diff --git a/hack/terraform/gcp/internal-loadbalancer/main.tf b/hack/terraform/gcp/internal-loadbalancer/main.tf index f29e38853..7f64b06e1 100644 --- a/hack/terraform/gcp/internal-loadbalancer/main.tf +++ b/hack/terraform/gcp/internal-loadbalancer/main.tf @@ -58,7 +58,9 @@ resource "random_password" "initSecret" { resource "google_compute_network" "vpc_network" { name = local.name + description = "Constellation VPC network" auto_create_subnetworks = false + mtu = 8896 } @@ -151,19 +153,20 @@ resource "google_compute_firewall" "firewall_internal_pods" { } module "instance_group_control_plane" { - source = "./modules/instance_group" - name = local.name - role = "ControlPlane" - uid = local.uid - instance_type = var.instance_type - instance_count = var.control_plane_count - image_id = var.image_id - disk_size = var.state_disk_size - disk_type = var.state_disk_type - network = google_compute_network.vpc_network.id - subnetwork = google_compute_subnetwork.vpc_subnetwork_backend.id - kube_env = local.kube_env - debug = var.debug + source = "./modules/instance_group" + name = local.name + role = "ControlPlane" + uid = local.uid + instance_type = var.instance_type + instance_count = var.control_plane_count + image_id = var.image_id + disk_size = var.state_disk_size + disk_type = var.state_disk_type + network = google_compute_network.vpc_network.id + subnetwork = google_compute_subnetwork.vpc_subnetwork_backend.id + alias_ip_range_name = google_compute_subnetwork.vpc_subnetwork.secondary_ip_range[0].range_name + kube_env = local.kube_env + debug = var.debug named_ports = flatten([ { name = "kubernetes", port = local.ports_kubernetes }, { name = "bootstrapper", port = local.ports_bootstrapper }, @@ -177,21 +180,22 @@ module "instance_group_control_plane" { } module "instance_group_worker" { - source = "./modules/instance_group" - name = local.name - role = "Worker" - uid = local.uid - instance_type = var.instance_type - instance_count = var.worker_count - image_id = var.image_id - disk_size = var.state_disk_size - disk_type = var.state_disk_type - network = google_compute_network.vpc_network.id - subnetwork = google_compute_subnetwork.vpc_subnetwork_backend.id - kube_env = local.kube_env - debug = var.debug - labels = local.labels - init_secret_hash = local.initSecretHash + source = "./modules/instance_group" + name = "${local.name}-1" + role = "Worker" + uid = local.uid + instance_type = var.instance_type + instance_count = var.worker_count + image_id = var.image_id + disk_size = var.state_disk_size + disk_type = var.state_disk_type + network = google_compute_network.vpc_network.id + subnetwork = google_compute_subnetwork.vpc_subnetwork_backend.id + alias_ip_range_name = google_compute_subnetwork.vpc_subnetwork.secondary_ip_range[0].range_name + kube_env = local.kube_env + debug = var.debug + labels = local.labels + init_secret_hash = local.initSecretHash } resource "google_compute_address" "loadbalancer_ip" { diff --git a/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/main.tf b/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/main.tf index 8e86828bd..87e048bbb 100644 --- a/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/main.tf +++ b/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/main.tf @@ -56,7 +56,7 @@ resource "google_compute_instance_template" "template" { subnetwork = var.subnetwork alias_ip_range { ip_cidr_range = "/24" - subnetwork_range_name = var.name + subnetwork_range_name = var.alias_ip_range_name } } diff --git a/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/variables.tf b/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/variables.tf index 98b359eda..5b5f55e6c 100644 --- a/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/variables.tf +++ b/hack/terraform/gcp/internal-loadbalancer/modules/instance_group/variables.tf @@ -79,3 +79,8 @@ variable "debug" { default = false description = "Enable debug mode. This will enable serial port access on the instances." } + +variable "alias_ip_range_name" { + type = string + description = "Name of the alias IP range to use." +}