helper/schema: adapt to ID being arg to ImportState

This commit is contained in:
Mitchell Hashimoto 2016-05-04 12:42:02 -07:00
parent d1a81379d0
commit 2bb814e3de
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
2 changed files with 5 additions and 5 deletions

View File

@ -215,7 +215,8 @@ func (p *Provider) Resources() []terraform.ResourceType {
} }
func (p *Provider) ImportState( func (p *Provider) ImportState(
info *terraform.InstanceInfo) ([]*terraform.InstanceState, error) { info *terraform.InstanceInfo,
id string) ([]*terraform.InstanceState, error) {
// Find the resource // Find the resource
r, ok := p.ResourcesMap[info.Type] r, ok := p.ResourcesMap[info.Type]
if !ok { if !ok {
@ -229,7 +230,7 @@ func (p *Provider) ImportState(
// Create the data // Create the data
data := r.Data(nil) data := r.Data(nil)
data.SetId(info.Id) data.SetId(id)
data.SetType(info.Type) data.SetType(info.Type)
// Call the import function // Call the import function

View File

@ -219,9 +219,8 @@ func TestProviderImportState_setsId(t *testing.T) {
} }
_, err := p.ImportState(&terraform.InstanceInfo{ _, err := p.ImportState(&terraform.InstanceInfo{
Id: "bar",
Type: "foo", Type: "foo",
}) }, "bar")
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }
@ -251,7 +250,7 @@ func TestProviderImportState_setsType(t *testing.T) {
_, err := p.ImportState(&terraform.InstanceInfo{ _, err := p.ImportState(&terraform.InstanceInfo{
Type: "foo", Type: "foo",
}) }, "bar")
if err != nil { if err != nil {
t.Fatalf("err: %s", err) t.Fatalf("err: %s", err)
} }