terraform/juju/home-maas/05-nova.tf

217 lines
4.5 KiB
Terraform
Raw Normal View History

2024-05-12 13:43:53 +00:00
resource "juju_machine" "ncc" {
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" "nova-cloud-controller" {
name = "nova-cloud-controller"
model = var.model-name
2024-05-07 15:57:23 +00:00
charm {
name = "nova-cloud-controller"
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.ncc :
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
},{
endpoint = "memcache"
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
region = var.openstack-region
vip = var.vips["nova-cc"]
network-manager = "Neutron"
2024-05-07 15:57:23 +00:00
console-access-protocol = "novnc"
2024-05-07 19:23:43 +00:00
console-proxy-ip = "local"
2024-05-07 15:57:23 +00:00
use-internal-endpoints = "true"
2024-05-07 19:23:43 +00:00
ram-allocation-ratio = var.ram-allocation-ratio
cpu-allocation-ratio = var.cpu-allocation-ratio
config-flags = "scheduler_max_attempts=20"
2024-05-07 15:57:23 +00:00
}
}
resource "juju_application" "nova-cloud-controller-mysql-router" {
name = "nova-cloud-controller-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-nova" {
name = "hacluster-nova"
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" "nova-cloud-controller-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.nova-cloud-controller.name
2024-05-07 15:57:23 +00:00
endpoint = "ha"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.hacluster-nova.name
2024-05-07 15:57:23 +00:00
endpoint = "ha"
}
}
resource "juju_integration" "nova-cloud-controller-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.nova-cloud-controller.name
2024-05-07 15:57:23 +00:00
endpoint = "shared-db"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.nova-cloud-controller-mysql-router.name
2024-05-07 15:57:23 +00:00
endpoint = "shared-db"
}
}
resource "juju_integration" "nova-cloud-controller-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.nova-cloud-controller-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" "nova-cloud-controller-rmq" {
model = var.model-name
2024-05-07 15:57:23 +00:00
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 = "amqp"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.rabbitmq-server.name
2024-05-07 15:57:23 +00:00
endpoint = "amqp"
}
}
resource "juju_integration" "nova-cloud-controller-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.nova-cloud-controller.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" "nova-cloud-controller-neutron" {
model = var.model-name
2024-05-07 15:57:23 +00:00
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 = "neutron-api"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.neutron-api.name
2024-05-07 15:57:23 +00:00
endpoint = "neutron-api"
}
}
resource "juju_integration" "nova-cloud-controller-nova-compute" {
model = var.model-name
2024-05-07 15:57:23 +00:00
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 = "cloud-compute"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.nova-compute-kvm.name
2024-05-07 15:57:23 +00:00
endpoint = "cloud-compute"
}
}
resource "juju_integration" "nova-cloud-controller-glance" {
model = var.model-name
2024-05-07 15:57:23 +00:00
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 = "image-service"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.glance.name
2024-05-07 15:57:23 +00:00
endpoint = "image-service"
}
}