2023-11-23 16:57:00 +01:00
|
|
|
# Define required providers
|
|
|
|
terraform {
|
|
|
|
required_version = ">= 0.14.0"
|
|
|
|
required_providers {
|
|
|
|
openstack = {
|
|
|
|
source = "terraform-provider-openstack/openstack"
|
|
|
|
version = "~> 1.53.0"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data "terraform_remote_state" "privnet_dns_router" {
|
|
|
|
backend = "local"
|
|
|
|
|
|
|
|
config = {
|
|
|
|
path = "../project-setup/terraform.tfstate"
|
|
|
|
}
|
|
|
|
}
|
2023-12-05 12:00:13 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Uses common_variables as module
|
|
|
|
#
|
|
|
|
module "common_variables" {
|
|
|
|
source = "../../modules/common_variables"
|
|
|
|
}
|
|
|
|
|
2023-12-13 15:05:37 +01:00
|
|
|
#
|
|
|
|
# Creates the server group "geoserver"
|
|
|
|
#
|
|
|
|
resource "openstack_compute_servergroup_v2" "geoserver_server_group" {
|
|
|
|
name = "geoserver"
|
|
|
|
policies = [module.common_variables.policy_list.soft_anti_affinity]
|
|
|
|
}
|
2023-12-05 12:00:13 +01:00
|
|
|
|
2023-12-05 17:46:36 +01:00
|
|
|
module "instance_with_data_volume" {
|
|
|
|
source = "../../modules/instance_with_data_volume"
|
2023-12-05 12:00:13 +01:00
|
|
|
|
2023-12-13 15:05:37 +01:00
|
|
|
instances_with_data_volume_map = {
|
|
|
|
geoserver_2 = {
|
|
|
|
name = "geoserver-2",
|
|
|
|
description = "Geoserver instance",
|
2023-12-05 12:00:13 +01:00
|
|
|
flavor = module.common_variables.flavor_list.m1_large,
|
2023-12-14 14:19:40 +01:00
|
|
|
networks = [data.terraform_remote_state.privnet_dns_router.outputs.main_private_network.name, module.common_variables.networks_list.shared_postgresql],
|
|
|
|
security_groups = [data.terraform_remote_state.privnet_dns_router.outputs.default_security_group_name, data.terraform_remote_state.privnet_dns_router.outputs.security_group_list.http_and_https_from_the_load_balancers],
|
2023-12-13 15:05:37 +01:00
|
|
|
server_groups_ids = [openstack_compute_servergroup_v2.geoserver_server_group.id],
|
2023-12-05 17:46:36 +01:00
|
|
|
image_ref = module.common_variables.ubuntu_1804,
|
|
|
|
volume = {
|
2023-12-13 15:05:37 +01:00
|
|
|
name = "geoserver_2_data_volume",
|
2023-12-05 17:46:36 +01:00
|
|
|
size = "50",
|
|
|
|
device = "/dev/vdb"
|
|
|
|
}
|
2023-12-05 12:00:13 +01:00
|
|
|
}
|
2023-12-13 15:05:37 +01:00
|
|
|
}
|
2023-12-05 17:46:36 +01:00
|
|
|
}
|