gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.09k stars 981 forks source link

0.67.0 --terragrunt-forward-tf-stdout not comprehensive #3370

Closed grimm26 closed 2 months ago

grimm26 commented 2 months ago

Describe the bug

the new --terragrunt-forward-tf-stdout flag does not make the output look like pre 0.67.0

Steps To Reproduce

Steps to reproduce the behavior, code snippets and examples which can be used to reproduce the issue.

❯ l
drwxr-xr-x 3 mkeisler mkeisler 4.0 KB Wed Aug 28 13:01:51 2024  .terraform
.rw-r--r-- 1 mkeisler mkeisler 1.3 KB Wed Aug 28 13:01:52 2024  .terraform.lock.hcl
.rw-rw-r-- 1 mkeisler mkeisler  38 B  Wed Aug 28 16:30:20 2024  main.tf
.rw-rw-r-- 1 mkeisler mkeisler   0 B  Wed Aug 28 13:02:10 2024  terragrunt.hcl
❯ cat main.tf
locals {
  foo = var.terraform_path
}
❯ cat terragrunt.hcl
❯ \terragrunt --terragrunt-forward-tf-stdout plan
16:30:51.164 INFO   Retrieved output from terragrunt.hcl
16:30:51.606 STDOUT terraform: ╷
16:30:51.606 STDOUT terraform: │ Error: Reference to undeclared input variable
16:30:51.606 STDOUT terraform: │ 
16:30:51.606 STDOUT terraform: │   on main.tf line 2, in locals:
16:30:51.606 STDOUT terraform: │    2:   foo = var.terraform_path
16:30:51.606 STDOUT terraform: │ 
16:30:51.606 STDOUT terraform: │ An input variable with the name "terraform_path" has not been declared.
16:30:51.606 STDOUT terraform: │ This variable can be declared with a variable "terraform_path" {} block.
16:30:51.606 STDOUT terraform: ╵
16:30:51.611 ERROR  terraform invocation failed in /tmp/tf error=[/tmp/tf] exit status 1
16:30:51.611 ERROR  1 error occurred:
    * [/tmp/tf] exit status 1

  /tmp/tf     

and with no error:

❯ cat main.tf
locals {
  foo = "bar"
}

output "foo" {
  value = local.foo
}
❯ \terragrunt --terragrunt-forward-tf-stdout plan
16:32:39.178 INFO   Retrieved output from terragrunt.hcl
16:32:39.625 INFO   Retrieved output from terragrunt.hcl

Changes to Outputs:
  + foo = "bar"

You can apply this plan to save these new output values to the Terraform
state, without changing any real infrastructure.

─────────────────────────────────────────────────────────────────────────────

Expected behavior

output shoudl look like pre 0.67.0

Additional context

https://github.com/gruntwork-io/terragrunt/issues/3367

levkohimins commented 2 months ago

Resolved in v0.67.5 release.