Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/network_interface_*association: handling the Network Interface being deleted during a refresh #8267

Merged
merged 6 commits into from
Aug 28, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ func resourceArmNetworkInterfaceApplicationGatewayBackendAddressPoolAssociationR
read, err := client.Get(ctx, resourceGroup, networkInterfaceName, "")
if err != nil {
if utils.ResponseWasNotFound(read.Response) {
return fmt.Errorf("Network Interface %q (Resource Group %q) was not found!", networkInterfaceName, resourceGroup)
log.Printf("Network Interface %q (Resource Group %q) was not found - removing from state!", networkInterfaceName, resourceGroup)
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving Network Interface %q (Resource Group %q): %+v", networkInterfaceName, resourceGroup, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ func resourceArmNetworkInterfaceApplicationSecurityGroupAssociationRead(d *schem
read, err := client.Get(ctx, resourceGroup, networkInterfaceName, "")
if err != nil {
if utils.ResponseWasNotFound(read.Response) {
return fmt.Errorf("Network Interface %q (Resource Group %q) was not found!", networkInterfaceName, resourceGroup)
log.Printf("[DEBUG] Network Interface %q (Resource Group %q) was not found - removing from state!", networkInterfaceName, resourceGroup)
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving Network Interface %q (Resource Group %q): %+v", networkInterfaceName, resourceGroup, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ func resourceArmNetworkInterfaceBackendAddressPoolAssociationRead(d *schema.Reso
read, err := client.Get(ctx, resourceGroup, networkInterfaceName, "")
if err != nil {
if utils.ResponseWasNotFound(read.Response) {
return fmt.Errorf("Network Interface %q (Resource Group %q) was not found!", networkInterfaceName, resourceGroup)
log.Printf("Network Interface %q (Resource Group %q) was not found - removing from state!", networkInterfaceName, resourceGroup)
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving Network Interface %q (Resource Group %q): %+v", networkInterfaceName, resourceGroup, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ func resourceArmNetworkInterfaceNatRuleAssociationRead(d *schema.ResourceData, m
read, err := client.Get(ctx, resourceGroup, networkInterfaceName, "")
if err != nil {
if utils.ResponseWasNotFound(read.Response) {
return fmt.Errorf("Network Interface %q (Resource Group %q) was not found!", networkInterfaceName, resourceGroup)
log.Printf("Network Interface %q (Resource Group %q) was not found - removing from state!", networkInterfaceName, resourceGroup)
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving Network Interface %q (Resource Group %q): %+v", networkInterfaceName, resourceGroup, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ func resourceArmNetworkInterfaceSecurityGroupAssociationRead(d *schema.ResourceD
read, err := client.Get(ctx, resourceGroup, name, "")
if err != nil {
if utils.ResponseWasNotFound(read.Response) {
return fmt.Errorf("Network Interface %q (Resource Group %q) was not found!", name, resourceGroup)
log.Printf("Network Interface %q (Resource Group %q) was not found - removing from state!", name, resourceGroup)
d.SetId("")
return nil
}

return fmt.Errorf("Error retrieving Network Interface %q (Resource Group %q): %+v", name, resourceGroup, err)
Expand Down