Clean up root module and move lldap to databases

This commit is contained in:
IamTheFij 2023-08-24 13:49:49 -07:00
parent 4a7bff7611
commit f6dd3f4284
8 changed files with 49 additions and 31 deletions

View File

@ -1,5 +0,0 @@
module "backups" {
source = "./backups"
use_wesher = var.use_wesher
}

13
core.tf
View File

@ -1,13 +0,0 @@
module "databases" {
source = "./databases"
}
module "core" {
source = "./core"
base_hostname = var.base_hostname
use_wesher = var.use_wesher
# Metrics and Blocky depend on databases
depends_on = [module.databases]
}

View File

@ -26,9 +26,3 @@ resource "nomad_job" "syslog-ng" {
resource "nomad_job" "ddclient" { resource "nomad_job" "ddclient" {
jobspec = file("${path.module}/ddclient.nomad") jobspec = file("${path.module}/ddclient.nomad")
} }
resource "nomad_job" "lldap" {
jobspec = templatefile("${path.module}/lldap.nomad", {
use_wesher = var.use_wesher,
})
}

View File

@ -36,3 +36,14 @@ resource "nomad_job" "redis" {
# Block until deployed as there are servics dependent on this one # Block until deployed as there are servics dependent on this one
detach = false detach = false
} }
resource "nomad_job" "lldap" {
jobspec = templatefile("${path.module}/lldap.nomad", {
use_wesher = var.use_wesher,
})
depends_on = [resource.nomad_job.mysql-server]
# Block until deployed as there are servics dependent on this one
detach = false
}

5
databases/vars.tf Normal file
View File

@ -0,0 +1,5 @@
variable "use_wesher" {
type = bool
description = "Indicates whether or not services should expose themselves on the wesher network"
default = true
}

33
main.tf Normal file
View File

@ -0,0 +1,33 @@
module "databases" {
source = "./databases"
use_wesher = var.use_wesher
}
module "core" {
source = "./core"
base_hostname = var.base_hostname
use_wesher = var.use_wesher
# Metrics and Blocky depend on databases
depends_on = [module.databases]
}
module "services" {
source = "./services"
use_wesher = var.use_wesher
# NOTE: It may be possible to flip this and core so core templates don't
# need to be rerendered every time a service goes up or down.
depends_on = [module.databases, module.core]
}
module "backups" {
source = "./backups"
use_wesher = var.use_wesher
depends_on = [module.databases, module.services, module.core]
}

View File

@ -1,7 +0,0 @@
module "services" {
source = "./services"
use_wesher = var.use_wesher
depends_on = [module.databases, module.core]
}