Skip to content

Commit

Permalink
use pre-existing floating IP for bastion
Browse files Browse the repository at this point in the history
  • Loading branch information
feber committed Nov 19, 2021
1 parent 83e0b78 commit 11f6720
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions contrib/terraform/openstack/kubespray.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module "ips" {
router_id = module.network.router_id
k8s_nodes = var.k8s_nodes
k8s_master_fips = var.k8s_master_fips
bastion_fips = var.bastion_fips
router_internal_port_id = module.network.router_internal_port_id
}

Expand Down
2 changes: 1 addition & 1 deletion contrib/terraform/openstack/modules/ips/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resource "openstack_networking_floatingip_v2" "k8s_node" {
}

resource "openstack_networking_floatingip_v2" "bastion" {
count = var.number_of_bastions
count = length(var.bastion_fips) > 0 ? 0 : var.number_of_bastions
pool = var.floatingip_pool
depends_on = [null_resource.dummy_dependency]
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/terraform/openstack/modules/ips/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ output "k8s_nodes_fips" {
}

output "bastion_fips" {
value = openstack_networking_floatingip_v2.bastion[*].address
value = length(var.bastion_fips) > 0 ? var.bastion_fips : openstack_networking_floatingip_v2.bastion[*].address
}
2 changes: 2 additions & 0 deletions contrib/terraform/openstack/modules/ips/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ variable "k8s_nodes" {}

variable "k8s_master_fips" {}

variable "bastion_fips" {}

variable "router_internal_port_id" {}
6 changes: 6 additions & 0 deletions contrib/terraform/openstack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ variable "k8s_master_fips" {
default = []
}

variable "bastion_fips" {
description = "specific pre-existing floating IPs to use for bastion node"
type = list(string)
default = []
}

variable "floatingip_pool" {
description = "name of the floating ip pool to use"
default = "external"
Expand Down

0 comments on commit 11f6720

Please sign in to comment.