terraform/juju/home-maas/04-mysql.tf
2024-05-07 20:23:43 +01:00

55 lines
1.3 KiB
HCL

resource "juju_machine" "mysql-1" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id])
constraints = "spaces=oam"
}
resource "juju_machine" "mysql-2" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id])
constraints = "spaces=oam"
}
resource "juju_machine" "mysql-3" {
model = var.model-name
placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id])
constraints = "spaces=oam"
}
resource "juju_application" "mysql-innodb-cluster" {
name = "mysql-innodb-cluster"
model = var.model-name
charm {
name = "mysql-innodb-cluster"
channel = var.mysql-channel
base = var.default-base
}
units = 3
placement = "${join(",",sort([
juju_machine.mysql-1.machine_id,
juju_machine.mysql-2.machine_id,
juju_machine.mysql-3.machine_id,
]))}"
endpoint_bindings = [{
space = var.oam-space
},{
endpoint = "cluster"
space = var.internal-space
},{
endpoint = "db-router"
space = var.internal-space
}]
config = {
source = var.openstack-origin
wait-timeout = "3600"
enable-binlogs = "false"
snapd_refresh = "max"
max-connections = var.mysql-connections
tuning-level = var.mysql-tuning-level
}
}