square-hair-965
03/08/2023, 12:33 AM@pulumi/pulumi/automation
package and ran into something of a unique issue. The command is basically "disabling" an item in a map in the config but I'm having trouble updating the config with the new structure. Just piping the json object back into it using setConfig
doesnt work. I get object
strings. If I stringify as json, it ends up being a json string.
I ended up installing the yaml package to help me do this but I'm still running into an issure. Currently the code looks like this:
await projectStack.setConfig('regions', { secret: false, value: yaml.stringify(newConfig) });
newConfig
being the updated config object i want to put back into the file as a yaml map- cloudwatch_alarm_region: us-east-1
enabled: false
latency_region: us-east-1
maintenance_override: false
name: prod-us-east-1-blue
region_id: us-east-1
regional_stack: qa-us-east-1
web_stack: prod-us-east-1-blue
- cloudwatch_alarm_region: us-west-2
enabled: true
latency_region: us-west-2
maintenance_override: false
name: prod-us-west-2-blue
region_id: us-west-2
regional_stack: qa-us-west-2
web_stack: prod-us-west-2-blue
- cloudwatch_alarm_region: ap-southeast-2
enabled: true
latency_region: ap-southeast-2
maintenance_override: false
name: prod-ap-southeast-2-blue
region_id: ap-southeast-2
regional_stack: qa-ap-southeast-2
web_stack: prod-ap-southeast-2-blue
After the update, it sets a |
character at the beginning:
global-route53:regions: |
- cloudwatch_alarm_region: us-east-1
enabled: false
latency_region: us-east-1
maintenance_override: false
name: prod-us-east-1-blue
region_id: us-east-1
regional_stack: qa-us-east-1
web_stack: prod-us-east-1-blue
- cloudwatch_alarm_region: us-west-2
enabled: false
latency_region: us-west-2
maintenance_override: false
name: prod-us-west-2-blue
region_id: us-west-2
regional_stack: qa-us-west-2
web_stack: prod-us-west-2-blue
- cloudwatch_alarm_region: ap-southeast-2
enabled: true
latency_region: ap-southeast-2
maintenance_override: false
name: prod-ap-southeast-2-blue
region_id: ap-southeast-2
regional_stack: qa-ap-southeast-2
web_stack: prod-ap-southeast-2-blue
this seems to be the setConfig
call doing this as console.logging the yaml.stringify call directly the | isn't there--path
option, harder than I thought grrrlittle-cartoon-10569
03/08/2023, 2:43 AMJust piping the json object back into it using setConfig doesnt work. I get object strings.Are those object strings the ones you get when you try to convert an Output to a string? That is, does your mapped object contain Outputs? You might be able to assign the map directly in the call to setConfig, if you setConfig inside an
apply()
.