Reputation: 1633
I have created the key/secret pair using the Vault UI.
How do I get the secret from Vault through Terraform?
Upvotes: 1
Views: 4336
Reputation: 11280
You need to define a vault provider, and fetch it as a data object. Here's a simple example:
provider "vault" {
address = "https://my-vault-address.com"
skip_tls_verify = true
token = "xxx"
}
data "vault_generic_secret" "my_secret" {
path = "secret/path/to/mysecret"
}
Then in order to use it:
...
pass = data.vault_generic_secret.my_secret.data["password"]
...
Upvotes: 6