You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem with implementing tests for Bicep where I am using if conditions together with getSecret function. Do you know how I can solve it or if it is something that is not possible to omit?
Example of code that generates error
Exception calling "GetBicepResources" with "3" argument(s): "Unable to expand resources because the source file 'd:\agents\agent_work\24\s/tests/environments/test.bicep' was not valid. The template parameter 'test' does not use the required format."
It may depend on what your goal is with the condition that either returning a secret or I assume a dummy value.
If you goal is to provide a test with a dummy value because you don't want to expose a secret in code then you shouldn't need to add the condition, you can just reference kv.getSecret() as you normally would where kv is an existing reference. For example:
Activity
github-actions commentedon Feb 21, 2023
Thanks for raising your first issue, the team appreciates the time you have taken 😉
ElinoraWhite commentedon Feb 21, 2023
PoborcaMaciej Thanks for raising the issue.
It may depend on what your goal is with the condition that either returning a secret or I assume a dummy value.
If you goal is to provide a test with a dummy value because you don't want to expose a secret in code then you shouldn't need to add the condition, you can just reference
kv.getSecret()as you normally would wherekvis an existing reference. For example:PSRule for Azure will automatically use a placeholder value during expansion.
Since this is more a question, I'm going to move it to discussion so that it might help someone else in the community out.
I hope that helps.