Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions terraform/bambi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,27 @@ variable "subdomain" {
default = null
}


variable "router_locations" {
type = map(string)
}

variable "checker_locations" {
type = map(string)
}

variable "engine_locations" {
type = map(string)
}

variable "elk_locations" {
type = map(string)
}

variable "vulnbox_locations" {
type = map(string)
}

locals {
subdomain = var.subdomain != null ? ".${var.subdomain}" : ""
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/bambichecker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resource "hcloud_server" "bambichecker" {
count = var.checker_count
name = "checker${count.index + 1}${local.subdomain}"
image = data.hcloud_image.bambichecker.id
location = var.home_location
location = try(var.checker_locations[count.index], var.home_location)
server_type = var.checker_type
ssh_keys = data.hcloud_ssh_keys.all_keys.*.id

Expand Down
2 changes: 1 addition & 1 deletion terraform/bambielk.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "hcloud_server" "bambielk" {
count = var.elk_count
name = "elk${local.subdomain}"
image = data.hcloud_image.bambielk[0].id
location = var.home_location
location = try(var.elk_locations[count.index], var.home_location)
server_type = var.elk_type
ssh_keys = data.hcloud_ssh_keys.all_keys.*.id

Expand Down
2 changes: 1 addition & 1 deletion terraform/bambiengine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "hcloud_server" "bambiengine" {
count = var.engine_count
name = "engine${local.subdomain}"
image = data.hcloud_image.bambiengine[0].id
location = var.home_location
location = try(var.engine_locations[count.index], var.home_location)
server_type = var.engine_type
ssh_keys = data.hcloud_ssh_keys.all_keys.*.id

Expand Down
2 changes: 1 addition & 1 deletion terraform/bambirouter.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource "hcloud_server" "bambirouter" {
count = var.router_count
name = "router${count.index + 1}${local.subdomain}"
image = data.hcloud_image.bambirouter.id
location = var.home_location
location = try(var.router_locations[count.index], var.home_location)
server_type = var.router_type
ssh_keys = data.hcloud_ssh_keys.all_keys.*.id

Expand Down
2 changes: 1 addition & 1 deletion terraform/bambivulnbox.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "hetznerdns_record" "bambivulnbox_dns" {
resource "hcloud_server" "bambivulnbox" {
name = "vulnbox${count.index + 1}${local.subdomain}"
image = data.hcloud_image.bambivulnbox.id
location = var.home_location
location = try(var.vulnbox_locations[count.index], var.home_location)
server_type = var.vulnbox_type
count = var.vulnbox_count
ssh_keys = data.hcloud_ssh_keys.all_keys.*.id
Expand Down
27 changes: 27 additions & 0 deletions terraform/terraform.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,30 @@ checker_type = "cx22"
engine_type = "cx22"
elk_type = "cpx31"
vulnbox_type = "cpx31"


# Assign locations to the VMs (0-indexed).
# If an index is not set, the default "home_location" is used
router_locations = {
"0" = "fsn1",
"1" = "nbg1"
}
checker_locations = {
"0" = "fsn1",
"1" = "nbg1",
"2" = "hel1",
"3" = "ash",
"4" = "hil",
"5" = "sin",
"6" = "fsn1",
"7" = "nbg1",
}
engine_locations = {
"0" = "fsn1"
}
elk_locations = {
"0" = "fsn1"
}
vulnbox_locations = {
"0" = "fsn1"
}