Environment specific vault values (Solved)

There was already the same topic but it was closed due to 30 days inactivity.
I still wanted to give the work around I’m using since I believe it will help others.

Lets assume you need to access an external api with an api key that differ in test and prod.

Here is the way I have vault variable based on the active environment.
It is a 3 steps process:

Define put the api keys in the vault:

  • external_api_key_test: t3sts3cr3t
  • external_api_key_prod: pr0ds3cr3t

Define less sensitive info in the environments

Test environment variables

Prod environment variables

Request Authorization (or directly on the collection)

  • Auth Type: Api Key
  • Key: api-key
  • Value: {{vault:external_api_key_{{vault_suffix}}}} // Here stands the magic
  • Add to: Header

Hope it helped.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.