Hi, After running `pulumi stack export | pulumi st...
# general
g
Hi, After running
pulumi stack export | pulumi stack import
to get ride of pending operations, the configuration of the stack was deleted. How to prevent this?
l
I haven't noticed that before. But
git co Pulumi.<stack>.yaml
should fix that.
g
But this behaviour is strange: if
pulumi stack import
writes the config,
pulumi stack export
should export it, no?
l
Import and export haven't (as best I can recall) affected the files in the directory for me. They affect the values saved to the backend, that's certainly expected. If one of those steps deleted your stack configuration file, that's probably a bug?
g
No, they didn't deleted the local file. The import deleted the remote config only. However, I would expect that if import over-writes on the remote config, then, export should express it in the json, so that i can give it back to import
I mean, is there a way to give import a json with the config?
l
I'm not sure what is missing. The config is used to build the stack. It's not used for anything once the stack is deployed. To make any changes, you need to use
pulumi up
, and that doesn't use remote config, just what's in the local yaml file. What isn't working?
g
The problem is that after
pulumi stack import
the config in the backend is deleted
I would not expect this
l
But it's not used for anything. It's just a record of what was used last time the stack was deployed. And it will be recreated next time config is needed.
g
OK. So we cannot count on it to store the config such that another user can use it. For example, we store there a mapping between a service and its image uri.
c
I don't think it is the right way to share the config. There are two ways you can share that mapping value: • Store your Pulumi code, including
Pulumi.<stack>.yaml
in a shared repository (such as GitHub). • Add that mapping value to the stack outputs, then you will be able to get it with the
pulumi stack output
command.
✔️ 1
b
Like @cuddly-magician-97620 said, this is what outputs are for!