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

136 lines
2.7 KiB
Terraform
Raw Normal View History

2024-05-12 13:43:53 +00:00
resource "juju_machine" "keystone" {
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+var.num_units]].machine_id])
constraints = "spaces=oam"
}
resource "juju_application" "keystone" {
name = "keystone"
model = var.model-name
charm {
name = "keystone"
2024-05-07 19:23:43 +00:00
channel = var.openstack-channel
}
2024-05-12 13:43:53 +00:00
units = var.num_units
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.keystone[index].machine_id
]))}"
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
},{
2024-05-07 19:23:43 +00:00
space = var.public-space
endpoint = "public"
},{
2024-05-07 19:23:43 +00:00
space = var.admin-space
endpoint = "admin"
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
endpoint = "internal"
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
endpoint = "shared-db"
}]
config = {
2024-05-07 19:23:43 +00:00
worker-multiplier = var.worker-multiplier
openstack-origin = var.openstack-origin
vip = var.vips["keystone"]
region = var.openstack-region
preferred-api-version = "3"
2024-05-07 19:23:43 +00:00
token-provider = "fernet"
admin-password = "openstack"
}
}
resource "juju_application" "keystone-mysql-router" {
name = "keystone-mysql-router"
model = var.model-name
charm {
name = "mysql-router"
2024-05-12 13:43:53 +00:00
channel = var.mysql-router-channel
}
units = 0
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.oam-space
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
endpoint = "shared-db"
},{
2024-05-07 19:23:43 +00:00
space = var.internal-space
endpoint = "db-router"
}]
config = {
2024-05-07 19:23:43 +00:00
source = var.openstack-origin
}
}
resource "juju_application" "hacluster-keystone" {
name = "hacluster-keystone"
model = var.model-name
charm {
2024-05-07 19:23:43 +00:00
name = "hacluster"
2024-05-12 13:43:53 +00:00
channel = var.hacluster-channel
}
units = 0
}
resource "juju_integration" "keystone-ha" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.keystone.name
endpoint = "ha"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.hacluster-keystone.name
endpoint = "ha"
}
}
resource "juju_integration" "keystone-mysql" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.keystone.name
endpoint = "shared-db"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.keystone-mysql-router.name
endpoint = "shared-db"
}
}
resource "juju_integration" "keystone-db" {
model = var.model-name
application {
2024-05-07 19:23:43 +00:00
name = juju_application.keystone-mysql-router.name
endpoint = "db-router"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.mysql-innodb-cluster.name
endpoint = "db-router"
}
}