Store secrets in a Vault KV secret store and generate a policy to access them.
In your Terraform file, instanciate the module with:
module "droopy_secrets" {
source = "github.com/edgelaboratories/terraform-vault-kv-secrets.git?ref=v2.0.0"
owner = "droopy"
secrets = {
"foo" = "hello"
"bar" = "world"
}
}This will store secrets under secrets/droopy and generate a policy that allows to read them.
By default, the policy will allow to read the secrets. If specific capabilities must be set, simply list them. E.g.
module "droopy_secrets" {
...
capabilities = ["read", "update"]
}If the KV store is not mounted on the path secrets, use the kv_path variable to change it. E.g.
module "droopy_secrets" {
...
kv_path = "secrets-2"
}path-- the path where secrets are stored;policy_name-- the name of the generated Vault policy.