Hi all, Could somebody please advise what would be...
# python
Hi all, Could somebody please advise what would be the best way to read a secret from the pulumi config file and print it or write it in a file when executing the pulumi main.py?
Here’s the code I am trying with:
Copy code
secret_config = pulumi.Config()
opensearch_secret = secret_config.get_secret('opensearch_master_user_password')

def get_secret_value(decrypted_value: str):
    return decrypted_value

                            {'registry_password': 'some-value', 
                            'registry_host': 'some-value', 
                            'registry_user': 'some-value'),
                            'opensearch_password': opensearch_secret.apply(get_secret_value),
                            'postgres_password': 'some-value',
                            'keycloak_password': 'some-value'},
But that doesn’t work. I am getting the following in the generated file.
Copy code
## -- Secrets of OpenSearch
    password: Calling __str__ on an Output[T] is not supported.

To get the value of an Output[T] as an Output[str] consider:
1. o.apply(lambda v: f"prefix{v}suffix")

See <https://www.pulumi.com/docs/concepts/inputs-outputs> for more details.
This function may throw in a future version of Pulumi.
You can write files by doing so in a callback/lambda passed to
on a single output or use
if you have to await many outputs. See some examples here: https://gist.github.com/olafurnielsen/c5bb06492e5456761e7fec584718a4a6
Thank you @adventurous-butcher-54166