infrastructure-as-code/openstack-tf/modules/geoserver/geoserver.tf

39 lines
1.4 KiB
HCL

# Geoserver attached volume - used for 'geoserver_data'
resource "openstack_blockstorage_volume_v3" "geoserver_data_vol" {
name = var.geoserver_basic_data.vol_data_name
size = var.geoserver_basic_data.vol_data_size
}
# Geoserver instance
resource "openstack_compute_instance_v2" "geoserver" {
name = var.geoserver_basic.name
availability_zone_hints = var.availability_zones_names.availability_zone_no_gpu
flavor_name = var.geoserver_basic.flavor
key_pair = var.ssh_key_file.name
security_groups = [var.security_group_list.default, var.security_group_list.http_and_https_from_the_load_balancers]
block_device {
uuid = var.ubuntu_1804.uuid
source_type = "image"
volume_size = 10
boot_index = 0
destination_type = "volume"
delete_on_termination = false
}
network {
name = var.main_private_network.name
}
network {
name = var.shared_postgresql_server_data.network_name
}
user_data = file("${var.ubuntu1804_data_file}")
}
# Attach the additional volume
resource "openstack_compute_volume_attach_v2" "geoserver_data_attach_vol" {
instance_id = openstack_compute_instance_v2.geoserver.id
volume_id = openstack_blockstorage_volume_v3.geoserver_data_vol.id
device = var.geoserver_basic_data.vol_data_device
depends_on = [openstack_compute_instance_v2.geoserver]
}