Skip to content

Commit

Permalink
Checking the type of the subnet before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Apr 18, 2017
1 parent fd03d03 commit 079043d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion builtin/providers/azurerm/resource_arm_virtual_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 079043d

Please sign in to comment.