vault icon indicating copy to clipboard operation
vault copied to clipboard

Vault injects missing variable as a variable with <no_value> string value

Open GinoPane opened this issue 1 year ago • 1 comments

We use vault to inject variables into containers, like this:

image

When the variable "SOME_VAR" is missing from the vault UI, it is being injected as variable with "<no_value>":

image

Why is it happening? Shouldn't it be skipped somehow?

GinoPane avatar Dec 16 '22 07:12 GinoPane

Please see https://github.com/hashicorp/consul-template/issues/972 for discussion on this topic.

maxb avatar Dec 16 '22 10:12 maxb

Hi there!

Going to close this - as discussed in https://github.com/hashicorp/consul-template/issues/972 (thanks maxb for linking that!) - there are two ways to change this behaviour:

  • Use the error_on_missing_key configuration Vault Agent: https://developer.hashicorp.com/vault/docs/agent/template#error_on_missing_key
  • Use another with clause to ensure the Data is there: e.g. {{ with .Data.b }}

Thanks! Violet

VioletHynes avatar Mar 16 '23 16:03 VioletHynes