Skip to content

Commit f9cd912

Browse files
authored
Merge pull request #32 from vngcloud/iam-vserver
fix bug import subnet
2 parents 08b50fc + 9b69dfe commit f9cd912

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

resource/vserver/resource_subnet.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ func ResourceSubnet() *schema.Resource {
2323
Importer: &schema.ResourceImporter{
2424
State: func(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
2525
idParts := strings.Split(d.Id(), ":")
26-
if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" {
27-
return nil, fmt.Errorf("Unexpected format of ID (%q), expected ProjectID:SubnetID", d.Id())
26+
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
27+
return nil, fmt.Errorf("Unexpected format of ID (%q), expected ProjectID:NetworkID:SubnetID", d.Id())
2828
}
2929
projectID := idParts[0]
30-
subnetID := idParts[1]
30+
networkID := idParts[1]
31+
subnetID := idParts[2]
3132
d.SetId(subnetID)
3233
d.Set("project_id", projectID)
34+
d.Set("network_id", networkID)
3335
return []*schema.ResourceData{d}, nil
3436
},
3537
},

0 commit comments

Comments
 (0)