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

53 lines
1.0 KiB
Terraform
Raw Normal View History

2024-05-12 13:43:53 +00:00
resource "juju_machine" "memcache" {
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-07 15:57:23 +00:00
constraints = "spaces=oam"
}
resource "juju_application" "memcached" {
name = "memcached"
model = var.model-name
2024-05-07 15:57:23 +00:00
charm {
2024-05-07 19:23:43 +00:00
name = "memcached"
channel = "latest/stable"
base = var.default-base
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.memcache :
res.machine_id
2024-05-07 15:57:23 +00:00
]))}"
2024-05-12 13:43:53 +00:00
2024-05-07 15:57:23 +00:00
endpoint_bindings = [{
2024-05-07 19:23:43 +00:00
space = var.internal-space
2024-05-07 15:57:23 +00:00
},{
endpoint = "cache"
2024-05-07 19:23:43 +00:00
space = var.internal-space
2024-05-07 15:57:23 +00:00
}]
config = {
allow-ufw-ip6-softfail = "true"
}
}
resource "juju_integration" "nova-cloud-controller-memcache" {
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 = "memcache"
}
application {
2024-05-07 19:23:43 +00:00
name = juju_application.memcached.name
2024-05-07 15:57:23 +00:00
endpoint = "cache"
}
}