# PostgreSQL server of the S2I2S OpenStack project. # # One VM with two interfaces: # - the main private network (10.10.0.162), used by ansible, the monitoring # and the backups; # - a dedicated network (192.168.0.0/22, address 192.168.0.5) created here, # which is the only one the database listens on. Every client needs a port # in that network carrying the 'vm_access_to_the_postgresql_service' # security group, exported by this workspace. # # Two SSD volumes, 100 GB each: the data directory and the write ahead log. # # Apply order: main_net_dns_router -> project-setup -> this one. # Network, DNS zone and images data "terraform_remote_state" "privnet_dns_router" { backend = "local" config = { path = "../main_net_dns_router/terraform.tfstate" } } # Security groups of the project (the 'default_for_all' one is needed here) data "terraform_remote_state" "project_setup" { backend = "local" config = { path = "../project-setup/terraform.tfstate" } } module "labs_common_variables" { source = "../../modules/labs_common_variables" } module "project_variables" { source = "../variables" } module "ssh_settings" { source = "../../modules/ssh-key-ref" } locals { # From the network/DNS state dns_zone = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone dns_zone_id = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone_id main_private_network_id = data.terraform_remote_state.privnet_dns_router.outputs.main_private_network_id main_private_subnet_id = data.terraform_remote_state.privnet_dns_router.outputs.main_subnet_network_id # From the project setup state default_security_group_id = data.terraform_remote_state.project_setup.outputs.default_security_group_id # From the common and project variables availability_zone = module.labs_common_variables.availability_zones_names.availability_zone_no_gpu ubuntu_2404 = module.labs_common_variables.ubuntu_2404 ubuntu2404_data_file = module.labs_common_variables.ubuntu2404_data_file resolvers_ip = module.labs_common_variables.resolvers_ip mtu_size = module.labs_common_variables.mtu_size main_region = module.labs_common_variables.main_region basic_services_ip = module.project_variables.basic_services_ip } module "postgresql" { source = "../../modules/postgresql" # Address plan of the project. The sizing and the dedicated network come from # the module defaults postgresql_main_ip = local.basic_services_ip.postgresql prometheus_cidr = local.basic_services_ip.prometheus_cidr main_private_network_id = local.main_private_network_id main_private_subnet_id = local.main_private_subnet_id default_security_group_id = local.default_security_group_id dns_zone_name = local.dns_zone.name resolvers_ip = local.resolvers_ip mtu_size = local.mtu_size main_region = local.main_region availability_zone = local.availability_zone image = { uuid = local.ubuntu_2404.uuid user_data_file = local.ubuntu2404_data_file } ssh_key_name = module.ssh_settings.ssh_key_name # A record on the main network address, so that the clients and the playbooks # can use the name instead of the address dns_zone_id = local.dns_zone_id postgresql_recordset_name = "postgresql.${local.dns_zone.name}" }