Skip to content

Commit

Permalink
Fix vip index errors for clusters with no LBs
Browse files Browse the repository at this point in the history
  • Loading branch information
haasad committed May 16, 2024
1 parent b49bcf9 commit ac33e9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions modules/vshn-lbaas-cloudscale/hiera.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module "hiera" {
ingress_controller = var.ingress_controller
lb_names = random_id.lb[*].hex
hieradata_repo_user = var.hieradata_repo_user
api_vip = cidrhost(local.api_vip.network, 0)
api_vip = cidrhost(local.api_vip[0].network, 0)
internal_vip = var.internal_vip
nat_vip = cidrhost(local.nat_vip.network, 0)
router_vip = cidrhost(local.router_vip.network, 0)
nat_vip = cidrhost(local.nat_vip[0].network, 0)
router_vip = cidrhost(local.router_vip[0].network, 0)
team = var.team
enable_proxy_protocol = var.enable_proxy_protocol

Expand Down
6 changes: 3 additions & 3 deletions modules/vshn-lbaas-cloudscale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ resource "cloudscale_server_group" "lb" {
}

locals {
api_vip = var.use_existing_vips ? data.cloudscale_floating_ip.api_vip[0] : cloudscale_floating_ip.api_vip[0]
router_vip = var.use_existing_vips ? data.cloudscale_floating_ip.router_vip[0] : cloudscale_floating_ip.router_vip[0]
nat_vip = var.use_existing_vips ? data.cloudscale_floating_ip.nat_vip[0] : cloudscale_floating_ip.nat_vip[0]
api_vip = var.use_existing_vips ? data.cloudscale_floating_ip.api_vip : cloudscale_floating_ip.api_vip
router_vip = var.use_existing_vips ? data.cloudscale_floating_ip.router_vip : cloudscale_floating_ip.router_vip
nat_vip = var.use_existing_vips ? data.cloudscale_floating_ip.nat_vip : cloudscale_floating_ip.nat_vip

instance_fqdns = formatlist("%s.${var.node_name_suffix}", random_id.lb[*].hex)

Expand Down
6 changes: 3 additions & 3 deletions modules/vshn-lbaas-cloudscale/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
output "api_vip" {
value = local.api_vip
value = var.lb_count > 0 ? local.api_vip[0] : ""
}

output "nat_vip" {
value = local.nat_vip
value = var.lb_count > 0 ? local.nat_vip[0] : ""
}

output "router_vip" {
value = local.router_vip
value = var.lb_count > 0 ? local.router_vip[0] : ""
}

output "server_names" {
Expand Down

0 comments on commit ac33e9b

Please sign in to comment.