Hello everyone! I have a stack created by using t...
# general
b
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
Not sure (I’ll need to double-check it) but you probably have to “migrate” the resources using aliases
b
Thanks, I'll take a look. I'm trying to replace the default provider in a stack, but no luck so far.
p
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
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
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
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
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
Yeah, that works, at least for me. I'll add this information in Github.
🙌 1