terraform/juju/home-maas/04-rmq.tf

41 lines
967 B
Terraform
Raw Normal View History

2024-05-12 13:43:53 +00:00
resource "juju_machine" "rmq" {
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_high[count.index+var.num_units]].machine_id])
constraints = "spaces=oam"
}
resource "juju_application" "rabbitmq-server" {
name = "rabbitmq-server"
model = var.model-name
charm {
name = "rabbitmq-server"
2024-05-12 13:43:53 +00:00
channel = var.rabbitmq-server-channel
}
units = 3
2024-05-12 13:43:53 +00:00
placement = "${join(",", sort([
for index, _ in slice(var.controller_ids, var.num_units, length(var.controller_ids)) :
juju_machine.rmq[index].machine_id
]))}"
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
},{
endpoint = "amqp"
2024-05-07 19:23:43 +00:00
space = var.internal-space
},{
endpoint = "cluster"
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
min-cluster-size = "3"
cluster-partition-handling = "pause_minority"
}
}