This message was deleted.
# general
s
This message was deleted.
b
w
Until #2059 is addressed, note that you can move things into components if you want - and use
aliases
on the instance of the component to adopt the existing resources without having to replace anything. 2059 is definitely the most direct solution to this scenario though.
b
hm, what if I
dummyResource(name, {}, { alias : pulumi.runtime.getRootResource, provider: mynewGlobalProvider})
? would it reparent all resources under dummy resource and as a result make all resources use new provider by default?
w
I do not believe that would work - though I'll admit I've never thought to try that specific approach 🙂. If it does - that's an intriguing workaround for 2059.
b
Didn't work 🙂
Copy code
class DummyRoot extends pulumi.ComponentResource {
   constructor(name: string, opts : pulumi.ComponentResourceOptions) {
      super("dummy", name, {}, opts)
      this.registerOutputs({})
   }
}

new DummyRoot("dummy", { provider: provider, aliases: [pulumi.runtime.getRootResource() as Promise<pulumi.URN>] });
new gcp.compute.Network("vpc_network", {})
h
The way I handled this in python (to handle localstack switching) was to define an
opts()
that inserted providers if there's no parent, eg:
foo.Bar('MyBar', ..., **opts())
as for shuffling data between stacks, this is an extremely common question but I haven't seen a satisfactory answer yet.
w
shuffling data between stacks
What precisely did you have in mind here? We have the following tools: 1. StackReference 2.
import
3.
aliases
Depending on which versions of this you are trying to do - one or more of those should help?