diff --git a/command/jsonconfig/config.go b/command/jsonconfig/config.go index 21775db7d..1911bfa22 100644 --- a/command/jsonconfig/config.go +++ b/command/jsonconfig/config.go @@ -303,15 +303,13 @@ func marshalResources(resources map[string]*configs.Resource, schemas *terraform } } - // TODO: get actual providerFqn - providerFqn := addrs.NewLegacyProvider(v.ProviderConfigAddr().LocalName) schema, schemaVer := schemas.ResourceTypeConfig( - providerFqn, + v.Provider, v.Mode, v.Type, ) if schema == nil { - return nil, fmt.Errorf("no schema found for %s", v.Addr().String()) + return nil, fmt.Errorf("no schema found for %s (in provider %s)", v.Addr().String(), v.Provider) } r.SchemaVersion = schemaVer diff --git a/command/jsonplan/plan.go b/command/jsonplan/plan.go index 7a8bf0efd..ee12a408c 100644 --- a/command/jsonplan/plan.go +++ b/command/jsonplan/plan.go @@ -183,7 +183,7 @@ func (p *plan) marshalResourceChanges(changes *plans.Changes, schemas *terraform addr.Resource.Resource.Type, ) if schema == nil { - return fmt.Errorf("no schema found for %s", r.Address) + return fmt.Errorf("no schema found for %s (in provider %s)", r.Address, rc.ProviderAddr.Provider) } changeV, err := rc.Decode(schema.ImpliedType()) diff --git a/command/jsonstate/state.go b/command/jsonstate/state.go index 1af503c1b..ab1b29683 100644 --- a/command/jsonstate/state.go +++ b/command/jsonstate/state.go @@ -291,7 +291,7 @@ func marshalResources(resources map[string]*states.Resource, module addrs.Module current.SchemaVersion = ri.Current.SchemaVersion if schema == nil { - return nil, fmt.Errorf("no schema found for %s", resAddr.String()) + return nil, fmt.Errorf("no schema found for %s (in provider %s)", resAddr.String(), r.ProviderConfig.Provider) } riObj, err := ri.Current.Decode(schema.ImpliedType()) if err != nil {