Score:0

Vault configuration supports environment variables?

cn flag

Most configs support inline variables from the environment. Does support Vault configuration supports environment variables? Something like:

      ui = true
      listener "tcp" {
        tls_disable = 1
        address = "[::]:8200"
        cluster_address = "[::]:8201"
      }
      storage "postgresql" {
        connection_url = $PG_URL // where PG_URL is an environment variable
      }

Score:0
cn flag

While it doesn’t directly support variables aside from the built-in environment variables, you can use a HEREDOC to dynamically populate the configuration file prior to execution. This is often necessary even with Terraform (another Hashicorp product) that has wide support for variable with the exception of their Backend configuration details.

Score:0
jp flag

At the moment it is not directly possible. Check this GH issue. But you can use envsubst.

devent avatar
cn flag
Thank you, so it's not possible currently (except somehow with Consul, but I don't want to use it)
Score:0
in flag

Although it is not possible, keep in mind that Vault will read environment variable for many configuration items if they are missing in the file.

For example, if you don't know the API address the clients should use beforehand, remove it from your configuration file and let Vault discover it through the VAULT_API_ADDR variable.

Otherwise run your "unresolved" file through envsubst like suggested by Alex like this:

< vault-unresolved-config.hcl envsubst > vault-config.hcl
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.