You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terragrunt HCL configuration uses [attributes](https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#attribute-definitions) when there are values that need to be defined for Terragrunt as a whole.
12
13
@@ -24,6 +25,15 @@ when crossing the boundary between Terragrunt and OpenTofu/Terraform. You must s
24
25
constraint](https://opentofu.org/docs/language/values/variables/#type-constraints) on the variable in OpenTofu/Terraform in
25
26
order for OpenTofu/Terraform to process the inputs as the right type.
26
27
28
+
<Sinceversion="v1.1.4">
29
+
30
+
The type constraint also decides how the value is read. A variable declared as `string`, or declared with no type at
31
+
all, receives the value verbatim. Every other type constraint makes OpenTofu/Terraform read the value as an HCL
32
+
expression, where `${...}` means interpolation. Terragrunt escapes those sequences for you when the module reads a value
33
+
as HCL, so text like `${just_a_string}` reaches the module as written.
#### String inputs reach modules with `${...}` intact
7
+
8
+
Passing a string input that contains `${...}` to a variable declared with a type other than `string` used to fail with `Variables not allowed`, because OpenTofu/Terraform parse those values as HCL expressions and read `${...}` as an interpolation. Reading a JSON or YAML file into an input hit this whenever the file happened to contain that sequence:
9
+
10
+
```hcl
11
+
inputs = {
12
+
config = file("./config.json")
13
+
}
14
+
```
15
+
16
+
Terragrunt now escapes interpolation sequences in string inputs when the module declares the variable with a type that makes the value parse as HCL, so `${...}` arrives as literal text instead of failing the run. Variables declared as `string`, and variables declared with no type at all, are read verbatim by OpenTofu/Terraform, and their values are still passed through untouched.
0 commit comments