Format OpenTofu configuration
This commit is contained in:
parent
e879899d90
commit
abb30623d0
|
|
@ -38,8 +38,8 @@ locals {
|
||||||
target = { kind = "Deployment", name = "local-registry" }
|
target = { kind = "Deployment", name = "local-registry" }
|
||||||
patch = yamlencode([
|
patch = yamlencode([
|
||||||
{
|
{
|
||||||
op = "replace"
|
op = "replace"
|
||||||
path = "/spec/template/spec/affinity/nodeAffinity/requiredDuringSchedulingIgnoredDuringExecution/nodeSelectorTerms/0/matchExpressions/0/values"
|
path = "/spec/template/spec/affinity/nodeAffinity/requiredDuringSchedulingIgnoredDuringExecution/nodeSelectorTerms/0/matchExpressions/0/values"
|
||||||
value = [var.registry_placement.node]
|
value = [var.registry_placement.node]
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
@ -49,8 +49,8 @@ locals {
|
||||||
patch = yamlencode([
|
patch = yamlencode([
|
||||||
{ op = "replace", path = "/spec/local/path", value = var.registry_placement.path },
|
{ op = "replace", path = "/spec/local/path", value = var.registry_placement.path },
|
||||||
{
|
{
|
||||||
op = "replace"
|
op = "replace"
|
||||||
path = "/spec/nodeAffinity/required/nodeSelectorTerms/0/matchExpressions/0/values"
|
path = "/spec/nodeAffinity/required/nodeSelectorTerms/0/matchExpressions/0/values"
|
||||||
value = [var.registry_placement.node]
|
value = [var.registry_placement.node]
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -16,26 +16,26 @@ terraform {
|
||||||
resource "null_resource" "k3s_control_plane" {
|
resource "null_resource" "k3s_control_plane" {
|
||||||
count = local.k3s_enabled ? 1 : 0
|
count = local.k3s_enabled ? 1 : 0
|
||||||
triggers = {
|
triggers = {
|
||||||
node_name = var.control_plane_node_name
|
node_name = var.control_plane_node_name
|
||||||
host = var.control_plane_host
|
host = var.control_plane_host
|
||||||
user = var.control_plane_user
|
user = var.control_plane_user
|
||||||
ssh_key_path = var.control_plane_ssh_key_path
|
ssh_key_path = var.control_plane_ssh_key_path
|
||||||
advertise_address = var.control_plane_advertise_address
|
advertise_address = var.control_plane_advertise_address
|
||||||
kubeconfig_path = var.kubeconfig_path
|
kubeconfig_path = var.kubeconfig_path
|
||||||
kubeconfig_owner = var.kubeconfig_owner
|
kubeconfig_owner = var.kubeconfig_owner
|
||||||
k3s_version = var.k3s_version
|
k3s_version = var.k3s_version
|
||||||
allow_hypervisor_host = var.k3s_allow_hypervisor_host
|
allow_hypervisor_host = var.k3s_allow_hypervisor_host
|
||||||
runtime_storage_path = var.k3s_runtime_storage_path
|
runtime_storage_path = var.k3s_runtime_storage_path
|
||||||
required_data_mount = var.k3s_required_data_mount
|
required_data_mount = var.k3s_required_data_mount
|
||||||
runtime_storage_helper = filesha256("${path.module}/../../scripts/k3s-runtime-storage-host.py")
|
runtime_storage_helper = filesha256("${path.module}/../../scripts/k3s-runtime-storage-host.py")
|
||||||
pod_network_cidr = var.pod_network_cidr
|
pod_network_cidr = var.pod_network_cidr
|
||||||
}
|
}
|
||||||
connection {
|
connection {
|
||||||
type = "ssh"
|
type = "ssh"
|
||||||
user = self.triggers.user
|
user = self.triggers.user
|
||||||
private_key = file(self.triggers.ssh_key_path)
|
private_key = file(self.triggers.ssh_key_path)
|
||||||
host = self.triggers.host
|
host = self.triggers.host
|
||||||
timeout = "30m"
|
timeout = "30m"
|
||||||
}
|
}
|
||||||
provisioner "remote-exec" {
|
provisioner "remote-exec" {
|
||||||
inline = [<<EOT
|
inline = [<<EOT
|
||||||
|
|
@ -85,20 +85,20 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "null_resource" "k3s_kubeconfig" {
|
resource "null_resource" "k3s_kubeconfig" {
|
||||||
count = local.k3s_enabled ? 1 : 0
|
count = local.k3s_enabled ? 1 : 0
|
||||||
depends_on = [null_resource.k3s_control_plane]
|
depends_on = [null_resource.k3s_control_plane]
|
||||||
triggers = {
|
triggers = {
|
||||||
control_plane_id = null_resource.k3s_control_plane[0].id
|
control_plane_id = null_resource.k3s_control_plane[0].id
|
||||||
host = var.control_plane_host
|
host = var.control_plane_host
|
||||||
user = var.control_plane_user
|
user = var.control_plane_user
|
||||||
ssh_key_path = var.control_plane_ssh_key_path
|
ssh_key_path = var.control_plane_ssh_key_path
|
||||||
advertise_address = var.control_plane_advertise_address
|
advertise_address = var.control_plane_advertise_address
|
||||||
kubeconfig_path = var.kubeconfig_path
|
kubeconfig_path = var.kubeconfig_path
|
||||||
kubeconfig_owner = var.kubeconfig_owner
|
kubeconfig_owner = var.kubeconfig_owner
|
||||||
}
|
}
|
||||||
provisioner "local-exec" {
|
provisioner "local-exec" {
|
||||||
interpreter = ["/bin/bash", "-lc"]
|
interpreter = ["/bin/bash", "-lc"]
|
||||||
command = <<EOT
|
command = <<EOT
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
tmp_file="$(mktemp)"
|
tmp_file="$(mktemp)"
|
||||||
trap 'rm -f "$tmp_file"' EXIT
|
trap 'rm -f "$tmp_file"' EXIT
|
||||||
|
|
@ -1662,7 +1662,7 @@ locals {
|
||||||
control_plane_node_label_pairs = [
|
control_plane_node_label_pairs = [
|
||||||
for label, value in merge(var.control_plane_node_labels,
|
for label, value in merge(var.control_plane_node_labels,
|
||||||
length(var.worker_nodes) == 0 ? { "homelab.dev/workload-class" = "platform" } : {}
|
length(var.worker_nodes) == 0 ? { "homelab.dev/workload-class" = "platform" } : {}
|
||||||
) : {
|
) : {
|
||||||
node_name = var.control_plane_node_name
|
node_name = var.control_plane_node_name
|
||||||
label = label
|
label = label
|
||||||
value = value
|
value = value
|
||||||
|
|
|
||||||
|
|
@ -93,45 +93,45 @@ locals {
|
||||||
|
|
||||||
resource "null_resource" "edge_services" {
|
resource "null_resource" "edge_services" {
|
||||||
triggers = {
|
triggers = {
|
||||||
instance_id = var.edge_instance_id
|
instance_id = var.edge_instance_id
|
||||||
host = var.edge_host
|
host = var.edge_host
|
||||||
user = var.edge_user
|
user = var.edge_user
|
||||||
install_dir = var.edge_install_dir
|
install_dir = var.edge_install_dir
|
||||||
install_docker = tostring(var.edge_install_docker)
|
install_docker = tostring(var.edge_install_docker)
|
||||||
server_name = var.server_name
|
server_name = var.server_name
|
||||||
server_names = join(" ", local.server_names)
|
server_names = join(" ", local.server_names)
|
||||||
certbot_domain_args = join(" ", [for name in local.server_names : "-d ${name}"])
|
certbot_domain_args = join(" ", [for name in local.server_names : "-d ${name}"])
|
||||||
backend_host = var.backend_host
|
backend_host = var.backend_host
|
||||||
backend_port = tostring(var.backend_port)
|
backend_port = tostring(var.backend_port)
|
||||||
gitea_backend_host = var.gitea_backend_host
|
gitea_backend_host = var.gitea_backend_host
|
||||||
gitea_backend_port = tostring(var.gitea_backend_port)
|
gitea_backend_port = tostring(var.gitea_backend_port)
|
||||||
heimdall_host = local.heimdall_backend_host
|
heimdall_host = local.heimdall_backend_host
|
||||||
heimdall_port = tostring(var.heimdall_backend_port)
|
heimdall_port = tostring(var.heimdall_backend_port)
|
||||||
oidc_host = local.oidc_backend_host
|
oidc_host = local.oidc_backend_host
|
||||||
oidc_port = tostring(var.oidc_backend_port)
|
oidc_port = tostring(var.oidc_backend_port)
|
||||||
jellyfin_host = local.jellyfin_backend_host
|
jellyfin_host = local.jellyfin_backend_host
|
||||||
jellyfin_port = tostring(var.jellyfin_backend_port)
|
jellyfin_port = tostring(var.jellyfin_backend_port)
|
||||||
jeannie_api_host = var.jeannie_api_backend_host
|
jeannie_api_host = var.jeannie_api_backend_host
|
||||||
jeannie_api_port = tostring(var.jeannie_api_backend_port)
|
jeannie_api_port = tostring(var.jeannie_api_backend_port)
|
||||||
office_host = var.office_backend_host
|
office_host = var.office_backend_host
|
||||||
office_port = tostring(var.office_backend_port)
|
office_port = tostring(var.office_backend_port)
|
||||||
matrix_server_name = var.matrix_server_name
|
matrix_server_name = var.matrix_server_name
|
||||||
element_server_name = var.element_server_name
|
element_server_name = var.element_server_name
|
||||||
matrix_enabled = tostring(var.matrix_enabled)
|
matrix_enabled = tostring(var.matrix_enabled)
|
||||||
certificate_sync_revision = "matrix-san-v1"
|
certificate_sync_revision = "matrix-san-v1"
|
||||||
enable_letsencrypt = tostring(var.enable_letsencrypt)
|
enable_letsencrypt = tostring(var.enable_letsencrypt)
|
||||||
letsencrypt_email = var.letsencrypt_email
|
letsencrypt_email = var.letsencrypt_email
|
||||||
letsencrypt_staging = tostring(var.letsencrypt_staging)
|
letsencrypt_staging = tostring(var.letsencrypt_staging)
|
||||||
certbot_version = "2"
|
certbot_version = "2"
|
||||||
lab_schedule_enabled = tostring(var.lab_schedule_enabled)
|
lab_schedule_enabled = tostring(var.lab_schedule_enabled)
|
||||||
lab_schedule_api_url = var.lab_schedule_api_url
|
lab_schedule_api_url = var.lab_schedule_api_url
|
||||||
lab_schedule_timezone = var.lab_schedule_timezone
|
lab_schedule_timezone = var.lab_schedule_timezone
|
||||||
agent_watchdog_hash = sha256(join("", [
|
agent_watchdog_hash = sha256(join("", [
|
||||||
filesha256("${path.module}/files/oracle-agent-watchdog.sh"),
|
filesha256("${path.module}/files/oracle-agent-watchdog.sh"),
|
||||||
filesha256("${path.module}/files/oracle-agent-watchdog.service"),
|
filesha256("${path.module}/files/oracle-agent-watchdog.service"),
|
||||||
filesha256("${path.module}/files/oracle-agent-watchdog.timer"),
|
filesha256("${path.module}/files/oracle-agent-watchdog.timer"),
|
||||||
]))
|
]))
|
||||||
config_hash = local.config_hash
|
config_hash = local.config_hash
|
||||||
}
|
}
|
||||||
|
|
||||||
connection {
|
connection {
|
||||||
|
|
|
||||||
|
|
@ -129,10 +129,10 @@ resource "null_resource" "pimox_template_vm_create" {
|
||||||
depends_on = [null_resource.provisioning_host]
|
depends_on = [null_resource.provisioning_host]
|
||||||
|
|
||||||
triggers = {
|
triggers = {
|
||||||
pimox_host = var.pimox_host
|
pimox_host = var.pimox_host
|
||||||
pimox_user = var.pimox_user
|
pimox_user = var.pimox_user
|
||||||
ssh_key_path = var.pimox_ssh_key_path
|
ssh_key_path = var.pimox_ssh_key_path
|
||||||
qm_bin = var.pimox_qm_bin
|
qm_bin = var.pimox_qm_bin
|
||||||
builder_version = "7"
|
builder_version = "7"
|
||||||
config_hash = local.config_hash
|
config_hash = local.config_hash
|
||||||
replace_existing = tostring(var.pimox_template_replace_existing)
|
replace_existing = tostring(var.pimox_template_replace_existing)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue