Skip to content

incorrect rendering of null and unknown in a map(string) #33016

@RBurot

Description

@RBurot

Terraform Version

Terraform >=1.4.0

Terraform v1.4.4
on linux_amd64

Terraform Configuration Files

variable "force_spn_rotation" {
  type = bool
}

resource "null_resource" "force_rotation" {
  triggers = {
    rotation = var.force_spn_rotation ? timestamp() : null
  }
}

Debug Output

terraform init https://gist.github.com/RBurot/31009782f8a5f8019ebb97937ee91221

terraform plan variable is true https://gist.github.com/RBurot/7b4475734b1405f2605ec5c01858cc39

terraform plan variable is false https://gist.github.com/RBurot/efe5bc2f25706168a19cf6d4abef855b

Expected Behavior

if variable is true

  + resource "null_resource" "force_rotation" {
      + id       = (known after apply)
      + triggers = {
          + "rotation" = (known after apply)
        }
    }

if variable is false

  + resource "null_resource" "force_rotation" {
      + id       = (known after apply)
      + triggers = {
          + "rotation" = null
        }
    }

Actual Behavior

if variable is true

+ resource "null_resource" "force_rotation" {
      + id       = (known after apply)
      + triggers = {}
    }

if variable is false

+ resource "null_resource" "force_rotation" {
      + id       = (known after apply)
      + triggers = {
          + "rotation" = "\x1b[90mnull\x1b[0m\x1b[0m"
        }
    }

Steps to Reproduce

  1. terraform init
  2. terraform plan

Additional Context

It's the expected behavior with the latest 1.3.9
it seems that appears with version 1.4.0 and it's currently present on 1.4.4 (even in the 1.5.0.Alpha)

References

No response

Metadata

Metadata

Assignees

Labels

bugconfirmeda Terraform Core team member has reproduced this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions