π‘ Tips Added
read-not-tracked β Points at every file read that reading filters miss
Terragrunt does not track a file read in a part of a config it evaluates only when it runs the unit: inputs, generate, remote_state, the hooks and extra_arguments of terraform, and the inputs of a variables block. A unit with this configuration is not selected by --filter 'reading=shared/provider.tf' or by a Git filter when shared/provider.tf changes:
terragrunt.hcl
generate "provider" {
path = "provider.tf"
if_exists = "overwrite"
contents = file("../shared/provider.tf")
}
The inputs-read-not-tracked tip pointed only at reads in inputs. The new read-not-tracked tip replaces it and points at a call to any file-reading function in any of these parts, including mark_as_read and mark_glob_as_read:
TIP (read-not-tracked): Terragrunt does not track files read in the parts of a config it evaluates only when it runs the unit, such as inputs, generate, and hooks, so reading and Git filters miss the units and stacks that read them.
Untracked file read in generate
--> app/terragrunt.hcl:4:15
|
4 | contents = file("../shared/provider.tf")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= Call file in locals and reference the local here.
See https://docs.terragrunt.com/features/filter/attributes#reading-based-expressions
Commands that track reads, such as run --all with a reading or Git filter and find --reading, print the tip.
See Reading-Based Expressions. Suppress the tip with --no-tip read-not-tracked or --no-tips. --no-tip inputs-read-not-tracked still works and suppresses the new tip.
variables-block β Points at inputs too large to pass to OpenTofu/Terraform
A unit with very large inputs can stop OpenTofu/Terraform from starting, with an argument list too long error.
With the variables-block experiment enabled, Terragrunt now prints the variables-block tip before the run when a unit's inputs are large enough to risk this error. It points at each input over the limit and shows the variables block to move it to:
TIP (variables-block): Terragrunt passes inputs to OpenTofu/Terraform as TF_VAR_ environment variables, and inputs this large can make OpenTofu/Terraform fail with argument list too long.
Input over the 32 KiB soft limit
--> ./terragrunt.hcl:6:3
|
6 | policy = local.policy
| ^^^^^^ TF_VAR_policy would be 41 KiB.
|
= Move it to a variables block, which writes it to a variables file:
variables {
kind = "tfvar"
nullable = true
inputs = {
policy = local.policy
}
}
See https://docs.terragrunt.com/reference/hcl/blocks/variables
Suppress the tip with --no-tip variables-block or --no-tips.
π§ͺ Experiments Added
commands-variable β Read the lists of commands by name with the commands variable
Four functions, e.g. get_terraform_commands_that_need_vars(), each return the list of OpenTofu/Terraform commands that accept one set of flags. Enable the commands-variable experiment to read the lists by name: commands.accept_vars, commands.accept_locking, commands.accept_input, and commands.accept_parallelism.
root.hcl
terraform {
extra_arguments "retry_lock" {
commands = commands.accept_locking
arguments = ["-lock-timeout=20m"]
}
}
terragrunt run --all --experiment commands-variable -- plan
The functions keep their behavior. See the commands variable reference.
slash-fns β Convert path separators with to_slash and from_slash
On Windows, the Terragrunt functions that return a path, e.g. path_relative_to_include(), separate its parts with backslashes. Enable the slash-fns experiment to convert them: to_slash(path) replaces each path separator of the operating system with a forward slash, and from_slash(path) replaces each forward slash with the path separator of the operating system.
root.hcl
remote_state {
backend = "s3"
config = {
bucket = "my-tofu-state"
key = "${to_slash(path_relative_to_include())}/tofu.tfstate"
region = "us-east-1"
}
}
terragrunt run --all --experiment slash-fns -- plan
On Linux and macOS, both functions return the path unchanged.
π§ͺ Experiments Updated
mcp-command β Tools write to disk only under --allow=fs-rw
The mcp server now reads files from disk and keeps what Terragrunt writes in memory until the tool call returns. A new fs-rw capability lets the tools write to disk.
OpenTofu/Terraform cannot see writes held in memory, so a server started without --allow=fs-rw changes in these ways:
- plan is served only under both --allow=exec and --allow=fs-rw, and scaffold only under --allow=fs-rw.
- fmt refuses a call that does not set check.
- --dangerously-allow-apply is refused at startup.
- Dependency outputs fall back to mock_outputs, and get_outputs reads the state itself, as both do without --allow=exec.
- catalog cannot clone a remote repository, and a git-range filter is refused.
To keep planning, add the capability to the server's arguments:
terragrunt mcp --allow=exec --allow=fs-rw --allow=http --allow=env
offline-cas β run --all --cas-offline reports every missing source at once
A run --all with --cas-offline skipped the dependents of a unit whose source was missing from the store, so their own missing sources only showed up on a later run:
- downloading source url git::https://example.com/vpc.git?ref=v1.0.0
...
- Unit 'app' did not run due to a failure in 'vpc'
It now looks up every source a unit would download before any unit runs, and fails with one error for each source the store cannot serve, naming the units that use it. Nothing runs until the store holds them all:
- unit vpc: https://example.com/vpc.git at v1.0.0 is not in the local CAS store and --cas-offline forbids fetching it; ...
- unit app: https://example.com/app.git at v1.0.0 is not in the local CAS store and --cas-offline forbids fetching it; ...
offline-cas β --cas-offline fails on SMB sources
A run with --cas-offline fetched an SMB source from its share, since SMB has no cheap probe and nothing was recorded to resolve it from. It now fails with an error naming the source:
smb://fileserver/share/modules/vpc has no key an online run could record for --cas-offline; pin the source, for example with a literal checksum=sha256:, or drop the flag
An SMB archive pinned with a literal checksum= resolves offline from the store once an online run has stored it.
To run on a host with no network, populate a store on a connected host and copy it across.
otel-logs - Records link to the correct span
Each otel-logs record of a unit, including the output of its hooks, now links to a span of that unit. Records logged outside a unit link to the root command span, and a failed command exports its final error there.
The log buffer now holds 32768 records. At exit, Terragrunt prints the count of records that the exporter did not confirm, e.g. records dropped from a full buffer. See OpenTelemetry.
outputs-block β An output block sets its own mock_strategy
The mock_strategy block of outputs applied to every output of the unit. An output block now accepts its own mock_strategy block. Each attribute it sets overrides the same attribute of the outputs block, for that output only.
outputs {
mock_strategy {
allowed_commands = ["validate", "plan"]
}
output "vpc_id" {
mock_value = "vpc-mock-id"
}
output "admin_role_arn" {
mock_value = "arn:aws:iam::123456789012:role/mock"
mock_strategy {
allowed_commands = ["validate"]
}
}
}
Before the unit is applied, a plan of a dependent reads the mock value of vpc_id and no value for admin_role_arn. The attributes of a dependency block still win over both blocks. See A mock strategy for one output.
outputs-block - hcl validate --outputs-mocked checks that dependency outputs have mock values
A dependency..outputs.
outputs-block β A dependency on a stack reads the outputs blocks of its units
A dependency block that points at a stack did not read the outputs blocks of the units in the stack, so the dependent had to set mock_outputs for each unit. It now reads the outputs block of each unit the stack generates, with the same rules as for a dependency on one unit.
dependency "networking" {
config_path = "../networking"
}
inputs = {
vpc_id = dependency.networking.outputs.vpc.vpc_id
}
Before the stack is applied, dependency.networking.outputs.vpc.vpc_id resolves to the mock_value that the vpc unit declares, for each command that the mock_strategy of the unit allows. Generate the stack before you run the dependent. See With a dependency on a stack.
outputs-block β hcl validate --outputs checks mock_outputs keys
A mock_outputs key for an output that the dependency does not declare passed terragrunt hcl validate --outputs, e.g. a key with a typo or a key for a removed output. The flag now reports each such key of an object that a dependency block writes directly as mock_outputs, with an Undeclared mock output error.