homelab-nomad/databases/mysql.tf

48 lines
947 B
Terraform
Raw Normal View History

2022-02-27 23:22:09 +00:00
resource "nomad_job" "mysql-server" {
hcl2 {
enabled = true
}
jobspec = file("${path.module}/mysql.nomad")
# Block until deployed as there are servics dependent on this one
detach = false
2022-02-27 23:22:09 +00:00
}
resource "nomad_job" "adminer" {
hcl2 {
enabled = true
}
jobspec = file("${path.module}/adminer.nomad")
}
2022-03-14 22:58:47 +00:00
# NOTE: This may need to be moved to after the services are created
resource "consul_config_entry" "mysql_intents" {
2022-03-14 23:56:44 +00:00
name = "mysql-server"
2022-03-14 22:58:47 +00:00
kind = "service-intentions"
config_json = jsonencode({
Sources = [
{
Action = "allow"
Name = "adminer"
Precedence = 9
Type = "consul"
},
{
Action = "allow"
Name = "nextcloud"
Precedence = 9
Type = "consul"
},
2022-06-23 16:48:01 +00:00
{
Action = "allow"
Name = "backups"
Precedence = 9
Type = "consul"
},
2022-03-14 22:58:47 +00:00
]
})
}