# Ephemeral error on passing to template

**URL:** <https://discuss.hashicorp.com/t/ephemeral-error-on-passing-to-template/75425>\
**Category:** Terraform\
**Created:** [June 12, 2025, 6:59pm UTC](https://discuss.hashicorp.com/t/ephemeral-error-on-passing-to-template/75425 "2025-06-12T18:59:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manuel.anda](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/manuel.anda/32/44060_2.png) [@manuel.anda](https://discuss.hashicorp.com/u/manuel.anda)\
**Post date:** [June 12, 2025, 6:59pm UTC](https://discuss.hashicorp.com/t/ephemeral-error-on-passing-to-template/75425/1 "2025-06-12T18:59:39Z")

</div>

Hi,

I am attempting to follow the example specified [here](https://www.hashicorp.com/en/blog/terraform-1-10-improves-handling-secrets-in-state-with-ephemeral-values). Am I understanding correctly that these ephemeral values can only be passed to other ephemeral objects. I attempted passing it into a template file but that still failed with:

│ 69: CLIENT\_ID = local.credentials.client\_id  
│ 70: SECRET = local.credentials.private\_key  
│ 71: }  
│ 72: )  
│  
│ Ephemeral values are not valid in resource arguments, because resource  
│ instances must persist between Terraform phases.

Using:  
terraform {  
required\_version = “\>= 1.10.5”

and:  
ephemeral “aws\_secretsmanager\_secret\_version” “my\_key” {  
secret\_id = “mysecret/keys”  
}

locals {  
credentials = jsondecode(ephemeral.aws\_secretsmanager\_secret\_version.my\_key.secret\_string)  
}

---

<div class="post-metadata">

**Author:** ![jbardin](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/jbardin/32/3325_2.png) [@jbardin](https://discuss.hashicorp.com/u/jbardin)\
**Post date:** [June 13, 2025, 4:48pm UTC](https://discuss.hashicorp.com/t/ephemeral-error-on-passing-to-template/75425/2 "2025-06-13T16:48:01Z")

</div>

Hi,

You didn’t show the part of the config which is causing the error, so it’s hard to say how you would resolve it. If you are trying to use the `template_file` data resource, that’s been deprecated in favor of the `templatefile` function, which may be able to solve your problem.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/hashicorp/original/1X/79bf76adfd92a75631996933098f9ce29d37abf3.svg) [@system](https://discuss.hashicorp.com/u/system)\
**Post date:** [December 10, 2025, 4:48pm UTC](https://discuss.hashicorp.com/t/ephemeral-error-on-passing-to-template/75425/3 "2025-12-10T16:48:56Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
