core: MockProvider not to panic if import mock function returns no attrs

This commit is contained in:
Martin Atkins 2018-09-06 13:27:05 -07:00
parent ebd3aba0be
commit 52c28183b5
1 changed files with 3 additions and 0 deletions

View File

@ -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)