https://pulumi.com logo
b

brash-kite-78002

07/19/2021, 9:51 AM
Hello everyone! I have a stack created by using the default AWS provider, if I create a new provider as a replacement for the default one, Pulumi tries to recreate all objects with the new provider. Is there any way to disable resource recreation in case of a provider change?
p

prehistoric-activity-61023

07/19/2021, 9:56 AM
Not sure (I’ll need to double-check it) but you probably have to “migrate” the resources using aliases
b

brash-kite-78002

07/19/2021, 10:19 AM
Thanks, I'll take a look. I'm trying to replace the default provider in a stack, but no luck so far.
p

prehistoric-activity-61023

07/19/2021, 10:22 AM
I’ve just taken a quick look at aliases but I cannot find there any field
provider
there. I’d need to dig a little bit more. What programming language are you using?
b

brash-kite-78002

07/19/2021, 10:33 AM
Typescript. Thank you again for your time!
I did a successful provider change in the stack itself, but it's quite a cumbersome operation. We have a bunch of the stacks, so I would definitely like to avoid it.
l

little-cartoon-10569

07/19/2021, 8:54 PM
Afaik you can achieve this only via stack export/edit/import. It's pretty laborious.
You could create the new provider, import the existing resources using the new provider, then
state delete
all the old resources, but I don't know if that's any less laborious. Probably has better error messages....
b

brash-kite-78002

07/20/2021, 10:31 AM
I think I've found the easiest way. If one would run
pulumi up
specifying only the created provider, Pulumi will update all resources with the new provider and won't replace them. For instance:
pulumi up --target urn:pulumi:aizi-test-cluster-uat::uat::pulumi:providers:aws::commonAwsProvider
🙌 1
l

little-cartoon-10569

07/20/2021, 9:50 PM
Wow, did that work? Good to know. That question does get asked from time to time. Might be a good candidate for putting on GitHub Discussions: https://github.com/pulumi/pulumi/discussions
b

brash-kite-78002

07/21/2021, 11:02 AM
Yeah, that works, at least for me. I'll add this information in Github.
🙌 1
3 Views