How can i transfer resources from one stack to oth...
# general
h
How can i transfer resources from one stack to other?
b
You can import them into the new stack using `pulumi import`https://www.pulumi.com/docs/reference/cli/pulumi_import/ which means that that stack can continue managing the resources and then delete them from the state file with
pulumi state delete
https://www.pulumi.com/docs/reference/cli/pulumi_state_delete/ which means the original stack won't be able to manage them anymore and you can remove them from the code
h
is it like importing all resources one by one?
b
Not necessarily. You can pass in a JSON file to the import command that contains a list of the resources you want to import. The import link about has the schema for that JSON file. Deleting resources from a state is done individually
h
i have a stack with some buckets in A i used
pulumi stack export --file buckets.json
and tried in stack B pulumi import --file buckets.json
it is not getting any resources
@brave-planet-10645 any update on this?
b
You don't use the stack export to then use
pulumi import
. You need to build a json file according to the spec here: https://www.pulumi.com/docs/reference/cli/pulumi_import/ and then use
pulumi import
h
That's hardly a spec... any example how to use it? pulumi import shows me no resources to import
243 Views