terraform/juju/home-maas-focal/05-placement.tf

162 lines
3.0 KiB
Terraform
Raw Normal View History

2024-05-12 13:43:53 +00:00
resource "juju_machine" "placement" {
count = var.num_units
2024-05-07 19:23:43 +00:00
model = var.model-name
2024-05-13 07:12:59 +00:00
placement = join(":", ["lxd", juju_machine.all_machines[var.controller_ids[count.index+var.num_units]].machine_id])
2024-05-07 15:57:23 +00:00
constraints = "spaces=oam"
}
resource "juju_application" "placement" {
name = "placement"
model = var.model-name
2024-05-07 15:57:23 +00:00
charm {
name = "placement"
2024-05-07 19:23:43 +00:00
channel = var.openstack-channel
2024-05-07 15:57:23 +00:00
}
2024-05-12 13:43:53 +00:00
units = var.num_units
2024-05-07 15:57:23 +00:00
2024-05-12 13:43:53 +00:00
placement = "${join(",", sort([
for res in juju_machine.placement :
res.machine_id
2024-05-07 15:57:23 +00:00
]))}"
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
2024-05-07 15:57:23 +00:00
},{
endpoint = "public"
2024-05-07 19:23:43 +00:00
space = var.public-space
2024-05-07 15:57:23 +00:00
},{
endpoint = "admin"
2024-05-07 19:23:43 +00:00
space = var.admin-space
2024-05-07 15:57:23 +00:00
},{
endpoint = "internal"
2024-05-07 19:23:43 +00:00
space = var.internal-space
2024-05-07 15:57:23 +00:00
},{
endpoint = "shared-db"
2024-05-07 19:23:43 +00:00
space = var.internal-space
2024-05-07 15:57:23 +00:00
}]
config = {
worker-multiplier = var.worker-multiplier
2024-05-07 19:23:43 +00:00
openstack-origin = var.openstack-origin
vip = var.vips["placement"]
2024-05-07 15:57:23 +00:00
}
}
resource "juju_application" "placement-mysql-router" {
name = "placement-mysql-router"
model = var.model-name
2024-05-07 15:57:23 +00:00
charm {
2024-05-07 19:23:43 +00:00
name = "mysql-router"
2024-05-12 13:43:53 +00:00
channel = var.mysql-router-channel
2024-05-07 15:57:23 +00:00
}
units = 0
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
2024-05-07 15:57:23 +00:00
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
2024-05-07 15:57:23 +00:00
endpoint = "shared-db"
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
2024-05-07 15:57:23 +00:00
endpoint = "db-router"
}]
config = {
source = var.openstack-origin
}
}
resource "juju_application" "hacluster-placement" {
name = "hacluster-placement"
model = var.model-name
2024-05-07 15:57:23 +00:00
charm {
name = "hacluster"
2024-05-12 13:43:53 +00:00
channel = var.hacluster-channel
2024-05-07 15:57:23 +00:00
}
units = 0
}
resource "juju_integration" "placement-ha" {
model = var.model-name
2024-05-07 15:57:23 +00:00
application {
2024-05-07 19:23:43 +00:00
name = juju_application.placement.name
2024-05-07 15:57:23 +00:00
endpoint = "ha"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.hacluster-placement.name
2024-05-07 15:57:23 +00:00
endpoint = "ha"
}
}
resource "juju_integration" "placement-mysql" {
model = var.model-name
2024-05-07 15:57:23 +00:00
application {
2024-05-07 19:23:43 +00:00
name = juju_application.placement.name
2024-05-07 15:57:23 +00:00
endpoint = "shared-db"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.placement-mysql-router.name
2024-05-07 15:57:23 +00:00
endpoint = "shared-db"
}
}
resource "juju_integration" "placement-db" {
model = var.model-name
2024-05-07 15:57:23 +00:00
application {
2024-05-07 19:23:43 +00:00
name = juju_application.placement-mysql-router.name
2024-05-07 15:57:23 +00:00
endpoint = "db-router"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.mysql-innodb-cluster.name
2024-05-07 15:57:23 +00:00
endpoint = "db-router"
}
}
resource "juju_integration" "placement-keystone" {
model = var.model-name
2024-05-07 15:57:23 +00:00
application {
2024-05-07 19:23:43 +00:00
name = juju_application.placement.name
2024-05-07 15:57:23 +00:00
endpoint = "identity-service"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.keystone.name
2024-05-07 15:57:23 +00:00
endpoint = "identity-service"
}
}
resource "juju_integration" "placement-nova" {
model = var.model-name
2024-05-07 15:57:23 +00:00
application {
2024-05-07 19:23:43 +00:00
name = juju_application.placement.name
2024-05-07 15:57:23 +00:00
endpoint = "placement"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.nova-cloud-controller.name
2024-05-07 15:57:23 +00:00
endpoint = "placement"
}
}