Bug report
I try to create VMs in proxmox, which should be added to a pool. The pool and the VM are configured through terragrunt, but different opentofu configs. I added a "dependency" in the VM terragrunt.hcl on the pool config to make sure that the pool is created before the VM is, so the VM can be added to the pool. Creation works perfectly, however, destroying VMs with their pool is a bit difficult: the pool is always tried to be destroyed first, then the VM. This however fails as the pool is not empty. After the VM has been destroyed, the pool can then be destroyed. My guess is that when a destroy is planned, the dependency order is not reverted (so on destroy the pool should depend on the VM plan being executed first).
I plan the destroy using "atlantis plan -- -destroy".
To Reproduce
Summarize how to reproduce the behavior. For example:
- Create 2 terragrunt configs
- Let one depend on the other
- Apply
- Run "atlantis plan -- -destroy" to plan a destroy
- Apply
Expected behavior
No error. I expected the depending plan to be applied first
Actual behavior
The dependency tree is not inverted and applying fails
Relevant Terragrunt files
VM config:
include {
path = find_in_parent_folders("backend.hcl")
}
terraform {
source = find_in_parent_folders("tf_vm_config")
}
dependency "pve_pool" {
config_path = "../"
skip_outputs = true
}
locals {
defaults = read_terragrunt_config(find_in_parent_folders("config.hcl"))
current_dir = basename(get_terragrunt_dir())
dir_parts = split("_", local.current_dir)
vm_date = length(local.dir_parts) > 0 ? local.dir_parts[0] : "000000"
nb_name = length(local.dir_parts) > 1 ? local.dir_parts[1] : "default-name"
proxmox_pool = basename(dirname(get_terragrunt_dir()))
}
inputs = merge(
local.defaults.inputs,
{
nb_name = local.nb_name
vm_name = "${local.vm_date}-${local.nb_name}"
vm_networks = ["network-name"]
proxmox_vm_pool = local.proxmox_pool
vm_root_disk_size = 80
vm_cpu = 8
vm_memory = 8
}
)
pool config:
include {
path = find_in_parent_folders("backend.hcl")
}
terraform {
source = find_in_parent_folders("tf_pool_config")
}
locals {
defaults = read_terragrunt_config(find_in_parent_folders("pool_config.hcl"))
current_dir = basename(get_terragrunt_dir())
}
inputs = merge(
local.defaults.inputs,
{
proxmox_vm_pool = local.current_dir
}
)
Should you need more information, please let me know :)
Bug report
I try to create VMs in proxmox, which should be added to a pool. The pool and the VM are configured through terragrunt, but different opentofu configs. I added a "dependency" in the VM terragrunt.hcl on the pool config to make sure that the pool is created before the VM is, so the VM can be added to the pool. Creation works perfectly, however, destroying VMs with their pool is a bit difficult: the pool is always tried to be destroyed first, then the VM. This however fails as the pool is not empty. After the VM has been destroyed, the pool can then be destroyed. My guess is that when a destroy is planned, the dependency order is not reverted (so on destroy the pool should depend on the VM plan being executed first).
I plan the destroy using "atlantis plan -- -destroy".
To Reproduce
Summarize how to reproduce the behavior. For example:
Expected behavior
No error. I expected the depending plan to be applied first
Actual behavior
The dependency tree is not inverted and applying fails
Relevant Terragrunt files
VM config:
pool config:
Should you need more information, please let me know :)