terraform-incus/config/nodes/ausyd1nxvm2062_images/terragrunt.hcl
Ben Vincent d4778f3fd7
Some checks failed
Build / build (pull_request) Failing after 2m4s
feat: add build job
- add build job that runs `make plan`
- enable provider caching
- enable creating client.crt/client.key
2025-10-17 12:37:54 +11:00

52 lines
1.7 KiB
HCL

locals {
config = yamldecode(file("${get_terragrunt_dir()}/config.yaml"))
local_images = yamldecode(file("${get_terragrunt_dir()}/images.yaml"))
local_networks = yamldecode(file("${get_terragrunt_dir()}/networks.yaml"))
local_profiles = yamldecode(file("${get_terragrunt_dir()}/profiles.yaml"))
local_storage_pools = yamldecode(file("${get_terragrunt_dir()}/storage_pools.yaml"))
local_storage_volumes = yamldecode(file("${get_terragrunt_dir()}/storage_volumes.yaml"))
node_name = basename(get_terragrunt_dir())
}
# on the image server we want to use localised settings mostly, not all the globals
# dont deep merge
include "root" {
path = find_in_parent_folders("root.hcl")
}
terraform {
source = "${get_repo_root()}/modules/node"
}
inputs = {
images = local.local_images
networks = local.local_networks
profiles = local.local_profiles
storage_pools = local.local_storage_pools
storage_volumes = local.local_storage_volumes
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
config_dir = "${get_env("INCUS_CONFIG_DIR")}"
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
}