Search code examples
terraformdatasourcevaultterraform-provider-vault

Data source doesn't refresh contents while planning


data "vault_generic_secret" "nr" {
  path = "secret/secrets"
}

I have this code to fetch data from Vault. I have added a new secret(newrelic_license_key) in the same vault location and while running terraform plan I am getting the following error:

"newrelic_license_key" does not exist in map data.vault_generic_secret.nr.data in:

${data.vault_generic_secret.nr.data["newrelic_license_key"]}

According to the data source documentation https://www.terraform.io/language/data-sources#data-resource-behavior

At least one of the given arguments is a managed resource attribute or other value that Terraform cannot predict until the apply step

Due to this I think data source should refresh secrets while applying and should not error out in the plan.

TF version: v0.11.15 Vault Provider Version: "< 3.0.0"


Solution

  • Terraform Version Upgrade resolved the issue.