diff --git a/helper/schema/provider.go b/helper/schema/provider.go index eca3dcd56..6c6daff3d 100644 --- a/helper/schema/provider.go +++ b/helper/schema/provider.go @@ -215,7 +215,8 @@ func (p *Provider) Resources() []terraform.ResourceType { } func (p *Provider) ImportState( - info *terraform.InstanceInfo) ([]*terraform.InstanceState, error) { + info *terraform.InstanceInfo, + id string) ([]*terraform.InstanceState, error) { // Find the resource r, ok := p.ResourcesMap[info.Type] if !ok { @@ -229,7 +230,7 @@ func (p *Provider) ImportState( // Create the data data := r.Data(nil) - data.SetId(info.Id) + data.SetId(id) data.SetType(info.Type) // Call the import function diff --git a/helper/schema/provider_test.go b/helper/schema/provider_test.go index 700eabc54..ba339f699 100644 --- a/helper/schema/provider_test.go +++ b/helper/schema/provider_test.go @@ -219,9 +219,8 @@ func TestProviderImportState_setsId(t *testing.T) { } _, err := p.ImportState(&terraform.InstanceInfo{ - Id: "bar", Type: "foo", - }) + }, "bar") if err != nil { t.Fatalf("err: %s", err) } @@ -251,7 +250,7 @@ func TestProviderImportState_setsType(t *testing.T) { _, err := p.ImportState(&terraform.InstanceInfo{ Type: "foo", - }) + }, "bar") if err != nil { t.Fatalf("err: %s", err) }