Add possibility to enable or disable public_ip4

This commit is contained in:
Johannes Rothe 2023-09-15 21:58:02 +02:00
parent c878461d0f
commit 50899b5893
Signed by: onjen
GPG Key ID: 73F092605AF3286C
7 changed files with 23 additions and 2 deletions

View File

@ -5,6 +5,7 @@ module "private_server_group" {
server_count = var.server_count
server_subnetwork_ip_range = var.subnetwork_ip_range
ssh_keys = var.ssh_keys
public_ipv4 = var.public_ipv4
}
module "loadbalancer" {
@ -16,4 +17,5 @@ module "loadbalancer" {
lb_external_ip = var.lb_external_ip
lb_service_id = var.lb_service_id
ssh_key_ids = module.private_server_group.ssh_key_ids
public_ipv4 = var.public_ipv4
}

View File

@ -9,7 +9,7 @@ resource "hcloud_server" "lb" {
ssh_keys = var.ssh_key_ids
public_net {
ipv4_enabled = true
ipv4_enabled = var.public_ipv4
ipv6_enabled = false
}

View File

@ -53,3 +53,9 @@ variable "ssh_key_ids" {
description = "SSH key IDs to add to the loadbalancer server"
type = list(number)
}
variable "public_ipv4" {
description = ""
type = bool
default = false
}

View File

@ -11,7 +11,7 @@ resource "hcloud_server" "private_node" {
ssh_keys = hcloud_ssh_key.main[*].id
public_net {
ipv4_enabled = true
ipv4_enabled = var.public_ipv4
ipv6_enabled = false
}

View File

@ -47,3 +47,9 @@ variable "ssh_keys" {
description = "SSH keys to add to the servers"
type = list(string)
}
variable "public_ipv4" {
description = ""
type = bool
default = false
}

View File

@ -5,4 +5,5 @@ subnetwork_ip_range = "10.0.0.0/24"
lb_internal_ip = "10.0.0.100"
lb_external_ip = "167.235.105.161"
lb_service_id = 1399502
public_ipv4 = true
ssh_keys = ["rothe.pub", "alt.pub"]

View File

@ -43,3 +43,9 @@ variable "ssh_keys" {
description = "SSH keys to add to servers"
type = list(string)
}
variable "public_ipv4" {
description = ""
type = bool
default = false
}