`terraform apply` with an ephemeral resource fails: `Ephemeral values are not valid` when you assign the secret to a normal resource argument.
AdvancedTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer
Likely causes → Ephemeral values (Terraform 1.10+) can only flow into other ephemeral contexts: provider config, ephemeral variables/outputs, locals, provisioner/connection blocks, or write-only arguments (1.11+). Normal arguments would persist them in state, so Terraform blocks it.
Diagnose → Check if the target argument is write-only in the provider docs (for example password_wo on aws_db_instance).
Fix →
ephemeral "random_password" "db" {
length = 24
}
resource "aws_db_instance" "main" {
# ...
password_wo = ephemeral.random_password.db.result
password_wo_version = 1
}
Bump password_wo_version to rotate.
Prevent → Check Terraform and provider versions in CI support ephemeral/write-only features before adopting them.
More on Modules, Variables, Sensitive Values and Workspaces
`Error: Module not installed` — `This module is not yet installed. Run "terraform init" to install all modules required by this configuration.`Beginner`Error: Failed to download module` — `git::https://github.com/acme/tf-modules.git?ref=v2.3.0 ... exit status 128` in CI, works locally.Intermediate`Error: Invalid module source address` for `source = "github.com/acme/modules//vpc?ref=v1.0"` with a `version = "1.0.0"` argument.BeginnerAfter bumping a registry module from 4.x to 5.x, plan shows dozens of resources destroyed and recreated.Advanced`Error: No value for required variable` — `The root module input variable "db_password" is not set, and has no default value.` in CI.Beginner`Error: Invalid value for variable` — `This was checked by the validation rule at variables.tf:8,3-13.`Beginner