Overview
There is a known bug #1211 in Terragrunt related to the way variables oftype = any are passed to Terraform. When Terragrunt serialises inputs, complex values assigned to type = any variables can be mis-typed, causing Terraform to reject them.
This module explicitly handles this issue. Every type = any variable is decoded with a try(jsondecode(...), ...) pattern inside main.tf, so you can safely pass a jsonencode()-wrapped string from your terragrunt.hcl instead of a native HCL value.
Variables that require jsonencode()
The following variables are declared with type = any (or type = map(string) but treated as complex objects). When setting them from a terragrunt.hcl inputs block you must wrap the value in jsonencode().
| Variable | Default | Notes |
|---|---|---|
cors_rule | [] | List of CORS rule maps |
lifecycle_rule | [] | List of lifecycle rule maps |
versioning | {} | Versioning configuration map |
logging | {} | Access logging configuration map |
server_side_encryption_configuration | {} | SSE configuration map |
intelligent_tiering | {} | Intelligent-Tiering configuration map |
metric_configuration | [] | Bucket metric configuration |
replication_configuration | {} | Cross-Region Replication map |
website | {} | Static website hosting map |
grant | [] | ACL policy grant list |
object_lock_configuration | {} | Object Lock configuration map |
Simple
string, bool, and number variables such as bucket, acl, and force_destroy do not need jsonencode(). Only the complex type = any variables listed above require it.Basic terragrunt.hcl inputs pattern
Complete example with versioning and lifecycle rules
The followingterragrunt.hcl demonstrates a bucket with versioning enabled and a lifecycle rule that moves non-current versions to Glacier after 90 days.
Identify type = any variables
Review the table above and identify which inputs you are setting that are declared as
type = any.Wrap complex values with jsonencode()
In your
terragrunt.hcl inputs block, wrap every type = any value with jsonencode().
