Loading...
Loading...
### Terraform Version ```shell Terraform v1.13.1 on windows_amd64 ``` ### Terraform Configuration Files ```terraform locals { obj = { asd = var.ephemeral_var foo = "bar" nnn = null } test = { for key, value in local.obj : key => value if value != null } } variable "ephemeral_var" { type = string ephemeral = true } ``` ### Debug Output Probably not relevant ### Expected Behavior When I run `ephemeralasnull(local.test)` in the terraform console I should get ```terraform { "asd" = tostring(null) "foo" = "bar" } ``` ### Actual Behavior When I run `ephemeralasnull(local.test)` in the terraform console I get ```terraform null /* object */ ``` ### Steps to Reproduce 1. `terraform init` 2. `terraform console -var=ephemeral_var=asd-val` 3. `ephemeralasnull(local.obj)` 4. `ephemeralasnull(local.test)` This one should have returned `{ "asd" = tostring(null), "foo" = "bar" }` but instead returns `null /* object */` ### Additional Context Workaround for this specific case (when checking for not null): ```terraform locals { obj = { asd = var.ephemeral_var foo = "bar" nnn = null } test = [ for key, value in local.obj : key if try(ephemeralasnull(md5(jsonencode(value) == "null" ? null : jsonencode(value))), "var was null") != "var was null" ] } variable "ephemeral_var" { type = string ephemeral = true } ``` ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.