-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Closed as not planned
Labels
bugnewnew issue not yet triagednew issue not yet triagedworking as designedconfirmed as reported and closed because the behavior is intendedconfirmed as reported and closed because the behavior is intended
Description
Terraform Version
terraform version
Terraform v1.11.0
on windows_amd64Terraform Configuration Files
locals {
string = "\\hello\\"
yaml = yamlencode({
string = "\\hello\\"
})
}
output "string" {
value = local.string
}
output "yaml" {
value = local.yaml
}
Debug Output
2025-03-18T17:57:08.935-0400 [INFO] Terraform version: 1.11.0
2025-03-18T17:57:08.937-0400 [DEBUG] using github.com/hashicorp/go-tfe v1.70.0
2025-03-18T17:57:08.937-0400 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.0
2025-03-18T17:57:08.937-0400 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-03-18T17:57:08.937-0400 [DEBUG] using github.com/zclconf/go-cty v1.16.0
2025-03-18T17:57:08.937-0400 [INFO] Go runtime version: go1.23.3
2025-03-18T17:57:08.937-0400 [INFO] CLI args: []string{"C:\\Program Files\\Terraform\\terraform.exe", "output", "-raw", "yaml"}
2025-03-18T17:57:08.937-0400 [TRACE] Stdout is a terminal of width 226
2025-03-18T17:57:08.937-0400 [TRACE] Stderr is a terminal of width 226
2025-03-18T17:57:08.937-0400 [TRACE] Stdin is a terminal
2025-03-18T17:57:08.939-0400 [DEBUG] Attempting to open CLI config file:
2025-03-18T17:57:08.939-0400 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2025-03-18T17:57:08.940-0400 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2025-03-18T17:57:08.940-0400 [DEBUG] ignoring non-existing provider search directory
2025-03-18T17:57:08.941-0400 [DEBUG] ignoring non-existing provider search directory
2025-03-18T17:57:08.941-0400 [INFO] CLI command args: []string{"output", "-raw", "yaml"}
2025-03-18T17:57:08.942-0400 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2025-03-18T17:57:08.942-0400 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2025-03-18T17:57:08.942-0400 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2025-03-18T17:57:08.943-0400 [TRACE] Meta.Backend: instantiated backend of type <nil>
2025-03-18T17:57:08.943-0400 [DEBUG] checking for provisioner in "."
2025-03-18T17:57:08.943-0400 [DEBUG] checking for provisioner in "C:\\Program Files\\Terraform"
2025-03-18T17:57:08.943-0400 [TRACE] Meta.Backend: backend <nil> does not support operations, so wrapping it in a local backend
2025-03-18T17:57:08.943-0400 [TRACE] backend/local: state manager for workspace "default" will:
- read initial snapshot from terraform.tfstate
- write new snapshots to terraform.tfstate
- create any backup at terraform.tfstate.backup
2025-03-18T17:57:08.943-0400 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
2025-03-18T17:57:08.944-0400 [TRACE] statemgr.Filesystem: read snapshot with lineage "2c5cd243-ff23-db0d-fe3a-0a94767070ab" serial 2
"string": "\\hello\\"
Expected Behavior
The raw yaml should have removed the escape characters in the same way that the string does.
As it is I can't run the terraform apply without the escape characters, but the output isn't valid.
Actual Behavior
terraform output
string = "\\hello\\"
yaml = <<EOT
"string": "\\hello\\"
EOT
terraform output -raw string
\hello\
terraform output -raw yaml
"string": "\\hello\\"
*The web interface to report this required that I change the double backslashes to quad backslashes to show the output I get from the console.
Steps to Reproduce
- Terraform Init
- Terraform apply
- Terraform output -raw string
- Terraform output -raw yaml
Additional Context
I am attempting to pass bash commands through yaml to aws_imagebuilder_component data.
When I apply the code with the escape characters that terraform required AWS is receiving the escape characters as part of the command.
References
No response
Generative AI / LLM assisted development?
No response
Metadata
Metadata
Assignees
Labels
bugnewnew issue not yet triagednew issue not yet triagedworking as designedconfirmed as reported and closed because the behavior is intendedconfirmed as reported and closed because the behavior is intended