diff --git a/.gitignore b/.gitignore index 18e0dca..09277b0 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,5 @@ terraform.rc # Ignore ssh_key_file_ref -**/ssh_key_file_ref.tf +**/ssh-key-ref-outputs.tf diff --git a/openstack-tf/modules/common_variables/variables.tf b/openstack-tf/modules/common_variables/variables.tf index 75c51ed..54cc3bc 100644 --- a/openstack-tf/modules/common_variables/variables.tf +++ b/openstack-tf/modules/common_variables/variables.tf @@ -177,3 +177,9 @@ variable "smartexecutor_addresses" { default = { } } + + +#Added by Francesco - It must contain the file 'ssh-key-ref-outputs.tf' (also added in the .gitignore) +module "ssh_settings" { + source = "../../modules/ssh-key-ref" +} diff --git a/openstack-tf/modules/geoserver/geoserver.tf b/openstack-tf/modules/geoserver/geoserver.tf index a6a1433..e909f37 100644 --- a/openstack-tf/modules/geoserver/geoserver.tf +++ b/openstack-tf/modules/geoserver/geoserver.tf @@ -1,3 +1,4 @@ + # Geoserver attached volume - used for 'geoserver_data' resource "openstack_blockstorage_volume_v3" "geoserver_data_vol" { name = var.geoserver_basic_data.vol_data_name @@ -9,7 +10,7 @@ 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 + key_pair = module.ssh_settings.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 diff --git a/openstack-tf/modules/ssh_keys/ssh-keys.tf b/openstack-tf/modules/ssh_keys/ssh-keys.tf index 662d992..dca6c18 100644 --- a/openstack-tf/modules/ssh_keys/ssh-keys.tf +++ b/openstack-tf/modules/ssh_keys/ssh-keys.tf @@ -1,4 +1,4 @@ resource "openstack_compute_keypair_v2" "initial_ssh_key" { - name = var.ssh_key_file.name - public_key = "${file("${var.ssh_key_file.file}.pub")}" + name = var.ssh_key_file.name + public_key = file("${var.ssh_key_file.file}.pub") }