Changed the logic to manage ssh settings

This commit is contained in:
Francesco Mangiacrapa 2023-11-24 17:16:20 +01:00
parent 6dd036a015
commit d459f11365
4 changed files with 11 additions and 4 deletions

2
.gitignore vendored
View File

@ -40,5 +40,5 @@ terraform.rc
# Ignore ssh_key_file_ref
**/ssh_key_file_ref.tf
**/ssh-key-ref-outputs.tf

View File

@ -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"
}

View File

@ -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

View File

@ -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")
}