https://pulumi.com logo
Title
a

average-france-9957

06/23/2022, 2:48 PM
Hello! I'm attempting to use the automation API to set an array in my yaml config file. I have a python list of
['us-east-1', 'us-east-2', 'ap-northeast-1', ...etc...]
and the end goal would be something like this in my config yaml
aws:regions:
    - "ap-northeast-2"
    - "ap-northeast-3"
    - ...etc...
My python snippet is
stack.set_config(f"aws:regions", auto.ConfigValue(value=regions))
but that throws
TypeError: expected str, bytes or os.PathLike object, not list
What is the best/correct way to set yaml arrays with the python automation API? Thanks you!
I was able to get this kind of working with JSON with the exception of a strangely formatted yaml
config:
  aws:regions: '["us-east-1", "eu-central-1", "ap-southeast-2", "ap-northeast-1"]'
automation.py
stack.set_config(f"{project}:regions", auto.ConfigValue(value=json.dumps(regions)))
pulumi.py
regions = json.loads(config.require("regions"))