Enable serial port in debug mode

This commit is contained in:
katexochen 2022-09-27 17:04:26 +02:00 committed by Paul Meyer
parent 14017e0f18
commit f69db6f26e
3 changed files with 10 additions and 0 deletions

View File

@ -129,6 +129,7 @@ module "instance_group_control_plane" {
network = google_compute_network.vpc_network.id network = google_compute_network.vpc_network.id
subnetwork = google_compute_subnetwork.vpc_subnetwork.id subnetwork = google_compute_subnetwork.vpc_subnetwork.id
kube_env = local.kube_env kube_env = local.kube_env
debug = var.debug
named_ports = flatten([ named_ports = flatten([
{ name = "kubernetes", port = local.ports_kubernetes }, { name = "kubernetes", port = local.ports_kubernetes },
{ name = "bootstrapper", port = local.ports_bootstrapper }, { name = "bootstrapper", port = local.ports_bootstrapper },
@ -152,6 +153,7 @@ module "instance_group_worker" {
network = google_compute_network.vpc_network.id network = google_compute_network.vpc_network.id
subnetwork = google_compute_subnetwork.vpc_subnetwork.id subnetwork = google_compute_subnetwork.vpc_subnetwork.id
kube_env = local.kube_env kube_env = local.kube_env
debug = var.debug
} }
resource "google_compute_global_address" "loadbalancer_ip" { resource "google_compute_global_address" "loadbalancer_ip" {

View File

@ -43,6 +43,7 @@ resource "google_compute_instance_template" "template" {
kube-env = var.kube_env kube-env = var.kube_env
constellation-uid = var.uid constellation-uid = var.uid
constellation-role = var.role constellation-role = var.role
serial-port-enable = var.debug ? "TRUE" : "FALSE"
} }
network_interface { network_interface {
@ -79,6 +80,7 @@ resource "google_compute_instance_template" "template" {
resource "google_compute_instance_group_manager" "instance_group_manager" { resource "google_compute_instance_group_manager" "instance_group_manager" {
name = local.name name = local.name
description = "Instance group manager for Constellation"
base_instance_name = local.name base_instance_name = local.name
target_size = var.instance_count target_size = var.instance_count

View File

@ -58,3 +58,9 @@ variable "named_ports" {
default = [] default = []
description = "Named ports for the instance group." description = "Named ports for the instance group."
} }
variable "debug" {
type = bool
default = false
description = "Enable debug mode. This will enable serial port access on the instances."
}