Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform v1.10 templatefile can't accept secrets #36123

Open
benjyiw opened this issue Nov 27, 2024 · 0 comments · May be fixed by #36127
Open

Terraform v1.10 templatefile can't accept secrets #36123

benjyiw opened this issue Nov 27, 2024 · 0 comments · May be fixed by #36127
Assignees
Labels
bug new new issue not yet triaged v1.10

Comments

@benjyiw
Copy link

benjyiw commented Nov 27, 2024

Terraform Version

Terraform v1.10.0
on linux_amd64

Terraform Configuration Files

locals {
  secrets = sensitive({ "key" = "value" })
}

output "template_output" {
  value = templatefile("test.yaml", local.secrets)
}

Debug Output

Copying the main error from the tf plan output for searchability:

Call to function "templatefile" failed: panic in function implementation: value is marked, so must be unmarked first

here's the gist containing full output: https://gist.github.com/benjyiw/a4ba664fefe0a06e9b4a823da46ba8e0

Expected Behavior

templatefile should accept accept secret values

Actual Behavior

terraform panics

Steps to Reproduce

  1. terraform init
  2. terraform plan

Additional Context

I provided the simplest example that I could muster for the bug report. In my case, I am pulling secrets from a cloud provider and merging them into a yaml file, which is where I saw the error for the first time this morning.

I can work around the problem by doing something like this:

sensitive(templatefile("test.yaml", nonsensitive(local.secrets)))

But I can't help but feel that this is a bug, so I opened the report.

Thanks!

References

No response

@benjyiw benjyiw added bug new new issue not yet triaged labels Nov 27, 2024
@jbardin jbardin self-assigned this Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug new new issue not yet triaged v1.10
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants