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