Hi, I've previously used an explicit provider for ...
# aws
c
Hi, I've previously used an explicit provider for resources in a stack:
Copy code
const role = new aws.iam.Role(`role-name`, {
      assumeRolePolicy: '...'
    },
    {
      provider
    });
Now I'd like to remove the provider option to use the default provider, but now pulumi wants to replace the resource:
Copy code
const role = new aws.iam.Role(`role-name`, {
      assumeRolePolicy: '...'
    });
Is there a way around this, or am I stuck with keeping the explicit provider or accepting the replace operation? Not that big of a deal for this particular resource, but it's worse for stuff like databases, queues, etc.
l
Unfortunately there is no simple support for this. There are two options that I have used that work well.
The easier depends on there not being any references to the resource (e.g. from child resources). You can delete the resource from state and import it again. Importing resources uses the default provider (unless you edit the created code).
The harder option is to export the stack, find the "wrong" and default providers, edit the resource's provider from the "wrong" one to the default, and import the stack. Not harder, I suppose, but more scary, with more potential for mistakes.
c
ok, got it. Thanks!