terraform-incus/config/nodes/prodnxsr0013/terragrunt.hcl
Ben Vincent 467e0bc42b
Some checks failed
Build / build (pull_request) Failing after 1m5s
feat: use INCUS_GLOBAL_CONF value
- set and pass INCUS_GLOBAL_CONF from makefile to terraform
- remove config_dir in all terragrunt.hcl files
2025-10-17 20:22:09 +11:00

43 lines
1.0 KiB
HCL

locals {
config = yamldecode(file("${get_terragrunt_dir()}/config.yaml"))
networks = yamldecode(file("${get_terragrunt_dir()}/networks.yaml"))
node_name = basename(get_terragrunt_dir())
}
include "root" {
path = find_in_parent_folders("root.hcl")
expose = true
merge_strategy = "deep"
}
terraform {
source = "${get_repo_root()}/modules/node"
}
inputs = {
networks = local.networks
node_name = local.node_name
node_addr = local.config.node_addr
node_port = local.config.node_port
}
generate "provider" {
path = "provider.tf"
if_exists = "overwrite_terragrunt"
contents = <<-EOF
provider "incus" {
generate_client_certificates = false
accept_remote_certificate = true
remote {
name = "${basename(get_terragrunt_dir())}"
scheme = "https"
address = "${local.config.node_addr}"
port = "${local.config.node_port}"
token = "${get_env("INCUS_TOKEN_${upper(local.node_name)}")}"
default = true
}
}
EOF
}