Terraform with Azure Key Vault to get secret value

experimenter picture experimenter · Oct 15, 2017 · Viewed 8k times · Source

Is there any way to get the value of a secret from Azure Key Vault?

Doesn't look like value gets exposed in the key vault secret object here.

Answer

guitarrapc picture guitarrapc · Jul 24, 2018

Now you can do it with azurerm_key_vault_secret data source.

I'm enjoying without any scripting.

data "azurerm_key_vault_secret" "test" {
  name      = "secret-sauce"
  vault_uri = "https://rickslab.vault.azure.net/"
}

output "secret_value" {
  value = "${data.azurerm_key_vault_secret.test.value}"
}