generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Terraform CLI and Provider Versions
Terraform v1.14.3
Provider cloudinit v2.3.7
Provider vault v5.7.0
Terraform Configuration
ephemeral "vault_kv_secret_v2" "secret" {
mount = "mount"
name = "path" // to do: use variables
}
data "cloudinit_config" "conf" {
gzip = false
base64_encode = true
part {
filename = "cloud-config.tpl"
content_type = "text/cloud-config"
content = templatefile(
"${path.module}/path/cloud-init.yaml",
{ key = ephemeral.vault_kv_secret_v2.secret.data.key }
)
}
}Expected Behavior
The cloudinit_config.part.content attribute should accept ephemeral values, allowing secrets to be injected directly from Vault KV v2 into cloud-init templates without storing them in Terraform state. This would enable fully dynamic and secure cloud-init generation entirely within Terraform.
Actual Behavior
Terraform returns an error:
Error: Invalid use of ephemeral value
with data.cloudinit_config.conf,
on main.tf line XXX, in data "cloudinit_config" "conf":
XXX: data "cloudinit_config" "conf" {
Ephemeral values are not valid for "part", because it is not an assignable
attribute.
Steps to Reproduce
List of steps to reproduce the issue.
- Define an ephemeral
vault_kv_secret_v2block - Reference
ephemeral.vault_kv_secret_v2.secret.data.keyin cloudinit_config.part.content - Run
terraform apply
How much impact is this issue causing?
High
Logs
No response
Additional Information
Current workaround exists using the deprecated data source:
data "vault_kv_secret_v2" "secret" {
mount = "mount"
name = "path"
}
- But relying on the deprecated data source is not a long-term solution.
- This feature would allow fully declarative, secret-safe cloud-init generation entirely within Terraform.
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request