core: MockProvider not to panic if import mock function returns no attrs
This commit is contained in:
parent
ebd3aba0be
commit
52c28183b5
|
@ -266,6 +266,9 @@ func (p *MockProvider) ImportResourceState(r providers.ImportResourceStateReques
|
|||
|
||||
if p.ImportStateReturn != nil {
|
||||
for _, is := range p.ImportStateReturn {
|
||||
if is.Attributes == nil {
|
||||
is.Attributes = make(map[string]string)
|
||||
}
|
||||
is.Attributes["id"] = is.ID
|
||||
schema := p.GetSchemaReturn.ResourceTypes[r.TypeName]
|
||||
private, err := json.Marshal(is.Meta)
|
||||
|
|
Loading…
Reference in New Issue