Hey folks :wave: I'm using a custom AWS provider, ...
# general
b
Hey folks 👋 I'm using a custom AWS provider, which gets correctly invoked when running
pulumi preview
or
pulumi up
. However if I run
pulumi import
it ignores my custom logic and uses default provider instead. Is that the expected behavior? Thanks!
Ok I've found this thread, but not sure if it makes sense in my case. This might work for Dynamic providers, but this is a resource provider with different parameters. My provider is just a wrapper for returning the default AWS one, with some additional custom logic before doing so
Copy code
export function provider(
  accountName?: AwsSonderAccountName,
  opts?: {
    name?: string;
    args?: aws.ProviderArgs;
    opts?: pulumi.ResourceOptions;
  }
): aws.Provider {
  pulumi.log.info('using custom provider - aws wrapper');
  <... Hiding some custom logic > 
  
  const provider = new aws.Provider(opts?.name ?? accountName, args, resourceOpts);
  return provider;
}
Example usage:
Copy code
export = async function () {

const opts = {
  provider: utils.aws.provider(),
};

const role = new aws.iam.Role(
    roleName,
    {
      <hiding for simplicity>
    }),
      tags
    },
    opts
  );
}