Skip to content

Instantly share code, notes, and snippets.

@tbeyer567
Created May 16, 2022 15:10
Show Gist options
  • Save tbeyer567/67bfd011a1cb3de09462a9f14734b0df to your computer and use it in GitHub Desktop.
Save tbeyer567/67bfd011a1cb3de09462a9f14734b0df to your computer and use it in GitHub Desktop.
path "auth/approle/role/agent/role-id" {
capabilities=["read"]
}
path "auth/approle/role/agent/secret-id" {
capabilities=["read","update"]
}
path "kv/data/application/db01" {
capabilities=["read"]
}
{{ with secret "kv/data/application/db01" }}
password: {{ .Data.data.password }}
{{ end }}
vault {
address = "https://vault:8200"
}
auto_auth {
method "approle" {
mount_path = "auth/approle"
config = {
role_id_file_path = "creds/role-id"
secret_id_file_path = "creds/secret-id"
# Helpful to accelerate testing vault agent config
# Default is true
remove_secret_id_file_after_reading = false
}
}
sink "file" {
wrap_ttl = "5m"
config = {
path = "creds/vault-token"
}
}
}
# Get db pass
template {
source = "application/db_pass.ctmpl"
destination = "application/db_pass.txt"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment