Greetings! What would be a good way of getting a ...
# python
c
Greetings! What would be a good way of getting a secret from a list ? Have a pulumi.*.yaml file like this:
Copy code
config:
  azure-native:location: eastus
  containerapp-environment:certificates:
    - name: my-web-cert
      password:
        secure: xxx
      value:
        secure: yyy
  containerapp-environment:certificates:
    - name: second-web-com
      password:
        secure: xxx
      value:
        secure: yyy
  containerapp-environment:env: dev
Where I would need to loop over the certificates, and grab the password and value and pass into a function creating the certificates;
Copy code
certificates = config.get_object("certificates")
..
if certificates:
    for certificate in certificates:
        name = certificate.get("name")
        password = x
        value = x

        cert = create_certificate(
            name=name,
            rg_name=rg,
            environment=managed_env,
            password=password,
            value=value,
            tags=tags,
            dependsOn=managed_env,
            location=location,
        )
h
Try
Copy code
configs = pulumi.Config()
password = config.get_secret('containerapp-environment:certificates:password')
c
Wouldn´t I somehow need to use get_secret to get the secret value? Also I need to loop over the certificates.
h
Sorry i missed the secret part, updated my above snippet. Also is your intention to loop through certificates to get its values, then you can get value using
('containerapp-environment:certificates:password')