Describe the bug
exclude{...} block does not work in terragrunt.stack.hcl files
Steps To Reproduce
Add the exclude{} block to terragrunt.stack.hcl
exclude { # former skip=true|false
if = true # Boolean to determine exclusion.
no_run=true # Boolean to prevent the unit from running (even when not using `--all`).
actions = [ # List of actions to exclude (e.g., "plan", "apply", "all", "all_except_output").
"all",
# "all_except_output",
# "plan",
# "apply",
# "destroy",
]
}
and run
$ terragrunt --version
terragrunt version v0.93.10
$ terragrunt plan --all
21:20:53.874 ERROR Error: Unsupported block type
21:20:53.875 ERROR on ./pathtostack/terragrunt.stack.hcl line 7, in exclude:
21:20:53.875 ERROR 7: exclude { # former skip=true|false
21:20:53.875 ERROR Blocks of type "exclude" are not expected here.
21:20:53.876 ERROR failed to generate stack file: error occurred:
* Failed to read stack file ./pathtostack/terragrunt.stack.hcl in ./evenlongerpath/pathtostack/terragrunt.stack.hcl:7,1-8: Unsupported block type; Blocks of type "exclude" are not expected here.
21:20:53.879 ERROR Unable to determine underlying exit code, so Terragrunt will exit with error code 1
NOTE: skip=true also was not working before it was deprecated
Expected behavior
It is expected that users are able to exclude stack processing from the queue.
Additional context
There are cases when a stack is used as a generator for units:
./_unit_tpl_many_of_these/terragrunt.hcl
include "root" {
path = find_in_parent_folders("root.hcl")
expose = true
}
locals {
base_source = "${dirname(find_in_parent_folders("root.hcl"))}/..//modules"
}
terraform {
source = "${local.base_source}/some_module"
}
# In this unit template, the queue control is used to exclude the template from processing
prevent_destroy = true
exclude {
if = try(!fileexists(".terragrunt-stack-manifest"), true)
actions = ["all"]
no_run = true
exclude_dependencies = false
}
inputs = try(read_terragrunt_config("terragrunt.values.hcl"), {})
./terragrunt.stack.hcl
locals {
# variables shared across units
some_var= "something"
}
unit "first_of_many" {
source = "./_unit_tpl_many_of_these"
path = "first_of_many"
no_dot_terragrunt_stack = true
values = merge(
local,
# overrides and extensions
{
some_var= "other_something"
}
)
}
Describe the bug
exclude{...} block does not work in terragrunt.stack.hcl files
Steps To Reproduce
Add the exclude{} block to terragrunt.stack.hcl
and run
NOTE:
skip=truealso was not working before it was deprecatedExpected behavior
It is expected that users are able to exclude stack processing from the queue.
Additional context
There are cases when a stack is used as a generator for units:
./_unit_tpl_many_of_these/terragrunt.hcl./terragrunt.stack.hcl