# # PostgreSQL server on a dedicated network. # # The module creates the dedicated network and subnet, the security groups, the # data and WAL volumes, the two ports (main network and dedicated network) and # the instance. Nothing is read from another state here: the caller passes in # everything that comes from the other workspaces. # # Sizing and dedicated network belong to the service, so they have defaults # here. The address on the main private network does not: it is part of the # address plan of the project, and it is passed in by the caller. # variable "postgresql_data" { description = "Instance, volumes and dedicated network of the PostgreSQL server" type = object({ name = optional(string, "postgresql") description = optional(string, "PostgreSQL server") flavor = optional(string, "m1.large") boot_vol_size = optional(number, 20) # Address on the dedicated network, the only one the service listens on server_ip = optional(string, "192.168.0.5") server_cidr = optional(string, "192.168.0.5/32") # Dedicated network and subnet network_name = optional(string, "postgresql-srv-net") network_description = optional(string, "Network used to communicate with the postgresql service") subnet_name = optional(string, "postgresql-srv-subnet") subnet_description = optional(string, "Subnet used to connect to the postgresql service") network_cidr = optional(string, "192.168.0.0/22") allocation_pool_start = optional(string, "192.168.0.100") allocation_pool_end = optional(string, "192.168.3.254") # Port the service listens on port = optional(number, 5432) # Data and WAL volumes. m1.large is RAM 8 - VCPUs 4 vol_data_name = optional(string, "postgresql-data") vol_data_size = optional(number, 100) vol_data_device = optional(string, "/dev/vdb") vol_wal_name = optional(string, "postgresql-wal") vol_wal_size = optional(number, 100) vol_wal_device = optional(string, "/dev/vdc") volume_type = optional(string, "CephSSD") }) default = {} } # Part of the address plan of the project: no default on purpose variable "postgresql_main_ip" { type = string description = "Address of the server on the main private network, used for the administration (ansible, monitoring, backups)" } # Data that comes from the network/DNS and project setup workspaces variable "main_private_network_id" { type = string description = "ID of the main private network of the project" } variable "main_private_subnet_id" { type = string description = "ID of the main private subnet of the project" } variable "default_security_group_id" { type = string description = "ID of the 'default_for_all' security group of the project" } variable "dns_zone_name" { type = string description = "Name of the DNS zone of the project, with the trailing dot" } variable "resolvers_ip" { type = list(string) description = "DNS resolvers configured on the dedicated subnet" } variable "mtu_size" { type = number description = "MTU of the dedicated network" } variable "main_region" { type = string description = "OpenStack region of the dedicated network" } variable "availability_zone" { type = string description = "Availability zone hint of the instance" } variable "image" { description = "Image of the instance: uuid and cloud-init user data file" type = object({ uuid = string user_data_file = string }) } variable "ssh_key_name" { type = string description = "Name of the SSH key pair injected by cloud-init" } # Optional DNS record, useful when the service has to be reached by name variable "dns_zone_id" { type = string default = "" description = "ID of the DNS zone. Required when postgresql_recordset_name is set" } variable "postgresql_recordset_name" { type = string default = "" description = "Name of an A record pointing to the main network address, with the trailing dot. Empty means no record" }