terraform/juju/home-maas-focal/04-mysql.tf

45 lines
1.0 KiB
Terraform
Raw Normal View History

2024-05-12 13:43:53 +00:00
resource "juju_machine" "mysql" {
count = var.num_units
model = juju_model.openstack.name
2024-05-12 13:43:53 +00:00
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index]].machine_id])
constraints = "spaces=oam"
}
resource "juju_application" "mysql-innodb-cluster" {
name = "mysql-innodb-cluster"
model = juju_model.openstack.name
charm {
name = "mysql-innodb-cluster"
2024-05-07 19:23:43 +00:00
channel = var.mysql-channel
base = var.default-base
}
2024-05-12 13:43:53 +00:00
units = var.num_units
2024-05-12 13:43:53 +00:00
placement = "${join(",", sort([
for res in juju_machine.mysql :
res.machine_id
]))}"
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
},{
endpoint = "cluster"
2024-05-07 19:23:43 +00:00
space = var.internal-space
},{
endpoint = "db-router"
2024-05-07 19:23:43 +00:00
space = var.internal-space
}]
config = {
2024-05-07 19:23:43 +00:00
source = var.openstack-origin
wait-timeout = "3600"
enable-binlogs = "false"
snapd_refresh = "max"
max-connections = var.mysql-connections
2024-05-07 19:23:43 +00:00
tuning-level = var.mysql-tuning-level
}
}