quick question, is there any way to request for sp...
# ask-the-community
e
quick question, is there any way to request for specific secrets based on the parameter of the task? For example, if I wanted to print the secret for a specific group, I would have to request secrets for all possible groups
Copy code
@task(secret_requests=[
   Secret(group='hello', key='my_key'),
   Secret(group='hello2', key='my_key')
]):
def print_secret(group: str):
    sm = current_context().secrets
    secret = sm.get(group, 'my_key')
    print(secret)
n
Hi Eric, at the moment parameterized secrets isn’t supported… I do have a few questions: 1. how many groups do you have? 2. does it make sense for you to expose the task to all group secrets? If you know the groups ahead of time, you could do something like:
Copy code
@task(secret_requests=[
   Secret(group=g, key='my_key') for g in groups
]):
def print_secret(group: str):
    sm = current_context().secrets
    secret = sm.get(group, 'my_key')
    print(secret)
e
We have a couple groups (10-20) with a standard set of keys that we know ahead of time. Currently I'm exposing them all with something like that but was curious if there was a more elegant solution.
thanks for the help! 🙂
k
Secrets dynamically is not possible as we have to mount things in, this is part of declarative infrastructure
e
That's good to know. I will rethink some of our organization then
158 Views