Terraform Version
Terraform v1.13.1
on linux_amd64
Use Cases
- Create a subdirectory testing/setup with:
ephemeral "vault_kv_secret_v2" "proxmox_creds" {
mount = "infra-secrets"
name = "testing/proxmox/creds"
}
locals {
proxmox_creds = ephemeral.vault_kv_secret_v2.proxmox_creds.data
}
output "creds" {
description = "Sensitive information obtained from Vault"
ephemeral = true
sensitive = true
value = {
proxmox = {
username = local.proxmox_creds.username
password = local.proxmox_creds.password
}
}
}
- Reference it from a .tftest.hcl file:
run "setup" {
module {
source = "./testing/setup"
}
}
- Run:
And you will see errors related to the fact that terraform does not allow the use of ephemeral values in the output of root modules.
$ > terraform test
tests/main.tftest.hcl... in progress
run "setup"... fail
╷
│ Error: Ephemeral output not allowed
│
│ on testing/setup/outputs.tf line 20:
│ 20: output "creds" {
│
│ Ephemeral outputs are not allowed in context of a root module
╵
run "apply"... skip
run "verify"... skip
$ > terraform validate
╷
│ Error: Ephemeral output not allowed
│
│ on testing/setup/outputs.tf line 20:
│ 20: output "creds" {
│
│ Ephemeral outputs are not allowed in context of a root module
╵
I think this is not entirely correct, although it is not critical, given that corresponding data sources are deprecated.
> $ terraform validate
╷
│ Warning: Deprecated Resource
│
│ with data.vault_kv_secret_v2.proxmox_creds,
│ on testing/setup/main.tf line 1, in data "vault_kv_secret_v2" "proxmox_creds":
│ 1: data "vault_kv_secret_v2" "proxmox_creds" {
│
│ Deprecated. Please use new Ephemeral KVV2 Secret resource `vault_kv_secret_v2` instead
╵
Success! The configuration is valid, but there were some validation warnings as shown above.
Attempted Solutions
I didn't find it. I had to use data sources instead of ephemeral data.
Proposal
No response
References
No response
Terraform Version
Use Cases
And you will see errors related to the fact that terraform does not allow the use of ephemeral values in the output of root modules.
I think this is not entirely correct, although it is not critical, given that corresponding data sources are deprecated.
Attempted Solutions
I didn't find it. I had to use data sources instead of ephemeral data.
Proposal
No response
References
No response