hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
42.76k stars 9.56k forks source link

terraform show PLANFILE does not include warnings #35885

Open RachaelSTamakloe opened 3 weeks ago

RachaelSTamakloe commented 3 weeks ago

Terraform Version

$ terraform -version
Terraform v1.9.8
on linux_amd64

Terraform Configuration Files

-Actual Context: https://github.com/GoogleCloudPlatform/cluster-toolkit/pull/3131

Simpler config file for reproducibility: In main.tf:

resource "google_compute_instance" "default" {
  name         = "test"
  machine_type = "n1-standard-1"
  zone         = "us-central1-a"
  project = "dev-pool-prj8"

  tags = ["foo", "bar"]

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }

  // Local SSD disk
  scratch_disk {
    interface = "SCSI"
  }

  network_interface {
    network = "default"

    access_config {
      // Ephemeral IP
    }
  }
}

# Check block outside the resource
check "instance_name_valid" {
  assert {
    condition = google_compute_instance.default.name != "test"
    error_message = "Instance name cannot be 'test'."
  }
}

Debug Output

https://gist.github.com/RachaelSTamakloe/9efdca0181602474c5657f00a25e4fbd

Expected Behavior

I expect the warning messages displayed in "terraform plan" to also be present in "terraform show PLANFILE," after it has been saved using "terraform plan -out PLANFILE"

Actual Behavior

"terraform show PLANFILE" fails to include warnings that are present in the output of terraform plan. When the output of terraform plan -out is saved in a PLANFILE and shown using "terraform show", warning messages that are originally present in terraform plan are not displayed in "terraform show PLANFILE".

Steps to Reproduce

  1. terraform init
  2. terraform plan -out my.tfplan
  3. terraform show my.tfplan

Additional Context

No response

References

No response

crw commented 19 hours ago

Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!