https://pulumi.com logo
#general
Title
# general
g

great-midnight-49300

06/27/2022, 6:21 AM
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

little-cartoon-10569

06/27/2022, 7:01 AM
I haven't noticed that before. But
git co Pulumi.<stack>.yaml
should fix that.
g

great-midnight-49300

06/27/2022, 7:04 AM
But this behaviour is strange: if
pulumi stack import
writes the config,
pulumi stack export
should export it, no?
l

little-cartoon-10569

06/27/2022, 7:26 AM
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

great-midnight-49300

06/27/2022, 7:35 AM
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

little-cartoon-10569

06/27/2022, 7:59 AM
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

great-midnight-49300

06/27/2022, 8:00 AM
The problem is that after
pulumi stack import
the config in the backend is deleted
I would not expect this
l

little-cartoon-10569

06/27/2022, 8:02 AM
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

great-midnight-49300

06/27/2022, 8:25 AM
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

cuddly-magician-97620

06/27/2022, 5:53 PM
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

bored-oyster-3147

06/27/2022, 7:44 PM
Like @cuddly-magician-97620 said, this is what outputs are for!
6 Views