Skip to content

Commit e279634

Browse files
committed
Make bastion host conditional in the connection
1 parent 01e2e81 commit e279634

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

openstack-device.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ resource "openstack_compute_floatingip_associate_v2" "registry" {
8484

8585
resource "null_resource" "registry" {
8686
connection {
87+
bastion_user = var.create_bastion ? var.image_user : null
88+
bastion_private_key = var.create_bastion ? tls_private_key.default.private_key_pem : null
89+
bastion_host = var.create_bastion ? openstack_compute_floatingip_associate_v2.bastion[0].floating_ip : null
8790
user = var.image_user
8891
private_key = tls_private_key.default.private_key_pem
8992
agent = false
@@ -131,6 +134,10 @@ resource "openstack_compute_instance_v2" "lab" {
131134
name = var.lab_net_ipv4
132135
}
133136

137+
timeouts {
138+
create = "30m"
139+
}
140+
134141
depends_on = [openstack_compute_keypair_v2.ufn_lab_key, null_resource.registry]
135142
}
136143

@@ -150,6 +157,9 @@ resource "null_resource" "lab" {
150157
count = var.lab_count
151158

152159
connection {
160+
bastion_user = var.create_bastion ? var.image_user : null
161+
bastion_private_key = var.create_bastion ? tls_private_key.default.private_key_pem : null
162+
bastion_host = var.create_bastion ? openstack_compute_floatingip_associate_v2.bastion[0].floating_ip : null
153163
user = var.image_user
154164
private_key = tls_private_key.default.private_key_pem
155165
agent = false

0 commit comments

Comments
 (0)