Hello! I'm attempting to use the automation API to...
# python
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
Copy code
    - "ap-northeast-2"
    - "ap-northeast-3"
    - ...etc...
My python snippet is
Copy code
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
Copy code
  aws:regions: '["us-east-1", "eu-central-1", "ap-southeast-2", "ap-northeast-1"]'
Copy code
stack.set_config(f"{project}:regions", auto.ConfigValue(value=json.dumps(regions)))
Copy code
regions = json.loads(config.require("regions"))