Checking the type of the subnet before using it

This commit is contained in:
tombuildsstuff 2017-04-18 16:20:29 +01:00
parent fd03d0310e
commit 079043d5f8
1 changed files with 4 additions and 1 deletions

View File

@ -275,7 +275,10 @@ func expandAzureRmVirtualNetworkVirtualNetworkSecurityGroupNames(d *schema.Resou
if v, ok := d.GetOk("subnet"); ok {
subnets := v.(*schema.Set).List()
for _, subnet := range subnets {
subnet := subnet.(map[string]interface{})
subnet, ok := subnet.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("[ERROR] Subnet should be a Hash - was '%+v'", subnet)
}
networkSecurityGroupId := subnet["security_group"].(string)
if networkSecurityGroupId != "" {