diff --git a/command/import.go b/command/import.go index 700006900..8480c91ee 100644 --- a/command/import.go +++ b/command/import.go @@ -174,7 +174,10 @@ func (c *ImportCommand) Run(args []string) int { providerAddr = relAddr.Absolute(addrs.RootModuleInstance) } else { // Use a default address inferred from the resource type. - providerAddr = resourceRelAddr.DefaultProviderConfig().Absolute(addrs.RootModuleInstance) + // We assume the same module as the resource address here, which + // may get resolved to an inherited provider when we construct the + // import graph inside ctx.Import, called below. + providerAddr = resourceRelAddr.DefaultProviderConfig().Absolute(addr.Module) } // Check for user-supplied plugin path