cyberark / summon

CLI that provides on-demand secrets access for common DevOps tools
https://cyberark.github.io/summon
MIT License
704 stars 62 forks source link

Summon Command Line Variable Expansion #178

Closed MatthiasScholzTW closed 3 years ago

MatthiasScholzTW commented 3 years ago

Summary

Using summon to fill parameter in the command line parameter is not working.

This is probably a misunderstanding of the usability of summon, but maybe there is a possibility on how to make this use case work.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Define MY_TEST_VAR: !var /test/my_test in your secrets.yml
  2. summon --provider <your_provider_of_choice> echo "${MY_TEST_VAR}"

A similar use case is to use it with curl

Expected Results

The content of the variable is available to run the command.

Actual Results (including error logs, if applicable)

The result is empty

Reproducible

Version/Tag number

Environment setup

BradleyBoutcher commented 3 years ago

Hi Matthias! Thank you for using Summon! I'm sorry you're having trouble getting the string interpolation to work, I recommend trying something like this:

$ summon -p <provider> /bin/bash -ec 'echo $FOO'

In your example above (summon --provider <your_provider_of_choice> echo "${MY_TEST_VAR}"), your shell will be performing the string interpolation before Summon can. When using double quotes around a variable, your current shell will attempt to read MY_TEST_VAR, while the value only exists in the summon subshell.

You can read a bit more about this in our troubleshooting guide here! Please let us know if this helps, and if you have any further questions!

Bradley