48 lines
1.9 KiB
Terraform
48 lines
1.9 KiB
Terraform
|
# VM used as jump proxy. A floating IP is required
|
||
|
resource "openstack_compute_instance_v2" "ssh_jump_proxy" {
|
||
|
name = module.common_variables.ssh_jump_proxy.name
|
||
|
availability_zone_hints = module.common_variables.availability_zones_names.availability_zone_no_gpu
|
||
|
flavor_name = module.common_variables.ssh_jump_proxy.flavor
|
||
|
key_pair = module.ssh_settings.ssh_key_name
|
||
|
security_groups = [module.common_variables.default_security_group_name,openstack_networking_secgroup_v2.access_to_the_jump_proxy.name]
|
||
|
block_device {
|
||
|
uuid = module.common_variables.ubuntu_2204.uuid
|
||
|
source_type = "image"
|
||
|
volume_size = 30
|
||
|
boot_index = 0
|
||
|
destination_type = "volume"
|
||
|
delete_on_termination = false
|
||
|
}
|
||
|
|
||
|
network {
|
||
|
name = module.common_variables.main_private_network.name
|
||
|
fixed_ip_v4 = module.common_variables.basic_services_ip.ssh_jump
|
||
|
}
|
||
|
user_data = "${file("${module.common_variables.ubuntu2204_data_file}")}"
|
||
|
}
|
||
|
|
||
|
# Floating IP and DNS record
|
||
|
resource "openstack_networking_floatingip_v2" "ssh_jump_proxy_ip" {
|
||
|
pool = module.common_variables.floating_ip_pools.main_public_ip_pool
|
||
|
# The DNS association does not work because of a bug in the OpenStack API
|
||
|
description = "SSH Proxy Jump Server"
|
||
|
}
|
||
|
|
||
|
resource "openstack_compute_floatingip_associate_v2" "ssh_jump_proxy" {
|
||
|
floating_ip = openstack_networking_floatingip_v2.ssh_jump_proxy_ip.address
|
||
|
instance_id = openstack_compute_instance_v2.ssh_jump_proxy.id
|
||
|
}
|
||
|
|
||
|
locals {
|
||
|
ssh_recordset_name = "${module.common_variables.ssh_jump_proxy.name}.${module.common_variables.dns_zone.zone_name}"
|
||
|
}
|
||
|
|
||
|
resource "openstack_dns_recordset_v2" "ssh_jump_proxy_recordset" {
|
||
|
zone_id = module.common_variables.dns_zone_id
|
||
|
name = local.ssh_recordset_name
|
||
|
description = "Public IP address of the SSH Proxy Jump server"
|
||
|
ttl = 8600
|
||
|
type = "A"
|
||
|
records = [openstack_networking_floatingip_v2.ssh_jump_proxy_ip.address]
|
||
|
}
|