Loading...
Loading...
### Terraform Version ```shell v1.0.11 through to v1.9.0. Reproduction below is 1.9.0. ``` ### Terraform Configuration Files No configuration needed ### Debug Output ``` 2024-07-03T10:29:31.570+1000 [INFO] Terraform version: 1.9.0 2024-07-03T10:29:31.570+1000 [DEBUG] using github.com/hashicorp/go-tfe v1.51.0 2024-07-03T10:29:31.570+1000 [DEBUG] using github.com/hashicorp/hcl/v2 v2.20.0 2024-07-03T10:29:31.570+1000 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1 2024-07-03T10:29:31.570+1000 [DEBUG] using github.com/zclconf/go-cty v1.14.4 2024-07-03T10:29:31.570+1000 [INFO] Go runtime version: go1.22.4 2024-07-03T10:29:31.570+1000 [INFO] CLI args: []string{"terraform", "fmt", "-"} 2024-07-03T10:29:31.570+1000 [TRACE] Stdout is a terminal of width 283 2024-07-03T10:29:31.570+1000 [TRACE] Stderr is a terminal of width 283 2024-07-03T10:29:31.570+1000 [TRACE] Stdin is not a terminal 2024-07-03T10:29:31.570+1000 [DEBUG] Attempting to open CLI config file: /Users/jacob/.terraformrc 2024-07-03T10:29:31.570+1000 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. 2024-07-03T10:29:31.571+1000 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins 2024-07-03T10:29:31.571+1000 [DEBUG] ignoring non-existing provider search directory /Users/jacob/.terraform.d/plugins 2024-07-03T10:29:31.571+1000 [DEBUG] ignoring non-existing provider search directory /Users/jacob/Library/Application Support/io.terraform/plugins 2024-07-03T10:29:31.571+1000 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins 2024-07-03T10:29:31.571+1000 [INFO] CLI command args: []string{"fmt", "-"} 2024-07-03T10:29:31.571+1000 [TRACE] terraform fmt: Formatting resource "foo" {} ``` ### Expected Behavior Output should be `resource "foo" "%[1]s" {}` ### Actual Behavior `resource "foo" {}` ### Steps to Reproduce 1. Run `echo 'resource "foo" "%[1]s" {}' | terraform fmt -` ### Additional Context I suspect this may be related to [string directive expressions](https://developer.hashicorp.com/terraform/language/expressions/strings#directives) which are used for evaluating conditionals however, I think `%[...]s` shouldn't be an catching and getting removed here as it is a valid Go template placeholder without an overlap in HCL (at least to my knowledge). ### References _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.