https://pulumi.com logo
#general
Title
# general
w

worried-xylophone-86184

09/13/2022, 8:42 AM
Hi all ! I have a question regarding extracting secrets from STACK configuration files. Based on this document, there is provision to store secrets based on a provided path. Something like this
Copy code
pulumi config set --path --secret endpoints[0].token accesstokenvalue
Now, if we wish to access this secret within the Pulumi script, I am not certain if we can access it directly like the usual way mentioned in the docs:
Copy code
import pulumi
config = pulumi.Config()
print(config.require_secret('dbPassword'))
How would we extract something that is deep in the STACK config file because the require_secret function takes a string and not a namespaced variable
v

victorious-dusk-75271

09/13/2022, 10:15 AM
you have to read the whole endpoints object
I dont know how to do this in python but it should look like this
Copy code
config.require_secret('endpoints').apply(a => a[0].token)