Ephemeral error on passing to template

Hi,

I am attempting to follow the example specified here. 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)
}

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.