cluster/infrastructure/home-assistant/main.tf

107 lines
2.4 KiB
Terraform
Raw Normal View History

ariable "flake_ref" {
type = string
}
variable "flake_sha" {
type = string
}
resource "nomad_volume" "home-assistant_hass" {
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
type = "csi"
plugin_id = "nfs"
volume_id = "home-assistant_hass"
name = "home-assistant_hass"
external_id = "home-assistant_hass"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.in.redalder.org"
share = "/var/nfs/home-assistant_hass"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nolock", "hard" ]
}
}
resource "nomad_volume" "home-assistant_zigbee2mqtt" {
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
type = "csi"
plugin_id = "nfs"
volume_id = "home-assistant_zigbee2mqtt"
name = "home-assistant_zigbee2mqtt"
external_id = "home-assistant_zigbee2mqtt"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.in.redalder.org"
share = "/var/nfs/home-assistant_zigbee2mqtt"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nolock", "hard" ]
}
}
resource "nomad_volume" "home-assistant_mosquitto" {
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
type = "csi"
plugin_id = "nfs"
volume_id = "home-assistant_mosquitto"
name = "home-assistant_mosquitto"
external_id = "home-assistant_mosquitto"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.in.redalder.org"
share = "/var/nfs/home-assistant_mosquitto"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nolock", "hard" ]
}
}
resource "vault_policy" "home-assistant-policy" {
name = "home-assistant-policy"
policy = file("${path.module}/home-assistant-policy.hcl")
}
resource "vault_policy" "zigbee2mqtt-policy" {
name = "zigbee2mqtt-policy"
policy = file("${path.module}/zigbee2mqtt-policy.hcl")
}
resource "vault_policy" "mosquitto-policy" {
name = "mosquitto-policy"
policy = file("${path.module}/mosquitto-policy.hcl")
}
resource "nomad_job" "home-assistant" {
jobspec = file("${path.module}/nomad.hcl")
hcl2 {
enabled = true
vars = {
flake_ref = var.flake_ref
flake_sha = var.flake_sha
}
}
}