cool-plastic-87476
02/07/2023, 1:31 PM@pulumi/pulumi/automation
package in one of our projects (using node.js). I run the following only once, when starting the server:
const stack: Stack = await LocalWorkspace.selectStack(
{
stackName: `sample-stack`,
workDir: 'sample'
},
{
envVars: {
PULUMI_ACCESS_TOKEN: process.env.PULUMI_ACCESS_TOKEN ?? '',
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID ?? '',
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY ?? ''
}
}
)
After this, I use the selected stack in my services and call await stack.setConfig
to set some configuration values. This all works and the configuration is showing up perfectly fine in the pulumi ui for my specific stack. Also pulumi up
runs without issues and uses the configuration as intended. However, when I redeploy my server from scratch and select the exact same stack with the code snippet above and then log await stack.getAllConfig()
the configuration returns an empty object.
I would expect the configuration that is visible in the pulumi ui, to be retrievable through this await stack.getAllConfig()
even after redeploying from scratch. It does work when I do not redeploy or restart though, but this won’t last forever 😉 Am I missing something or doing something wrong here? Or is it not a feature of this package?
Looking forward to your answers! 🙂billowy-army-68599
stack.getAllConfig()
after you’ve run a destroy?stack.getAllConfig
will only return a value after a successgul stack.up
operationcool-plastic-87476
02/07/2023, 1:51 PMstack.getAllConfig()
which returns an empty object.
If I would run a pulumi up in step 3, after running the stack selection but before anything else, it cleans configurations and deletes all resourcesbillowy-army-68599
getAllConfig
after you run setConfig
cool-plastic-87476
02/07/2023, 1:58 PMbillowy-army-68599
pulumi destroy
?cool-plastic-87476
02/07/2023, 1:59 PMbillowy-army-68599
refresh
first after you select the stackcool-plastic-87476
02/07/2023, 2:09 PMpulumi.refresh()
(since that one also cleaned my configuration) instead of the pulumi.refreshConfig()
😄 Thanks a lot 🙂