Merge pull request #8607 from hashicorp/arm-reorder-get-request-checks
provider/azurerm: Reordering the checks after an Azure API Get
This commit is contained in:
commit
94f9e1d4ab
|
@ -117,13 +117,13 @@ func resourceArmAvailabilitySetRead(d *schema.ResourceData, meta interface{}) er
|
||||||
name := id.Path["availabilitySets"]
|
name := id.Path["availabilitySets"]
|
||||||
|
|
||||||
resp, err := availSetClient.Get(resGroup, name)
|
resp, err := availSetClient.Get(resGroup, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Availability Set %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Availability Set %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
availSet := *resp.Properties
|
availSet := *resp.Properties
|
||||||
d.Set("platform_update_domain_count", availSet.PlatformUpdateDomainCount)
|
d.Set("platform_update_domain_count", availSet.PlatformUpdateDomainCount)
|
||||||
|
|
|
@ -225,13 +225,13 @@ func resourceArmCdnEndpointRead(d *schema.ResourceData, meta interface{}) error
|
||||||
}
|
}
|
||||||
log.Printf("[INFO] Trying to find the AzureRM CDN Endpoint %s (Profile: %s, RG: %s)", name, profileName, resGroup)
|
log.Printf("[INFO] Trying to find the AzureRM CDN Endpoint %s (Profile: %s, RG: %s)", name, profileName, resGroup)
|
||||||
resp, err := cdnEndpointsClient.Get(name, profileName, resGroup)
|
resp, err := cdnEndpointsClient.Get(name, profileName, resGroup)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure CDN Endpoint %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure CDN Endpoint %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
d.Set("host_name", resp.Properties.HostName)
|
d.Set("host_name", resp.Properties.HostName)
|
||||||
|
|
|
@ -99,13 +99,13 @@ func resourceArmCdnProfileRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
name := id.Path["Profiles"]
|
name := id.Path["Profiles"]
|
||||||
|
|
||||||
resp, err := cdnProfilesClient.Get(name, resGroup)
|
resp, err := cdnProfilesClient.Get(name, resGroup)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure CDN Profile %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure CDN Profile %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.Sku != nil {
|
if resp.Sku != nil {
|
||||||
d.Set("sku", string(resp.Sku.Name))
|
d.Set("sku", string(resp.Sku.Name))
|
||||||
|
|
|
@ -2,9 +2,9 @@ package azurerm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/Azure/azure-sdk-for-go/arm/network"
|
"github.com/Azure/azure-sdk-for-go/arm/network"
|
||||||
"github.com/Azure/azure-sdk-for-go/core/http"
|
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -110,14 +110,13 @@ func resourceArmLocalNetworkGatewayRead(d *schema.ResourceData, meta interface{}
|
||||||
|
|
||||||
resp, err := lnetClient.Get(resGroup, name)
|
resp, err := lnetClient.Get(resGroup, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error reading the state of Azure ARM local network gateway '%s': %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("Error reading the state of Azure ARM local network gateway '%s': %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
d.Set("location", resp.Location)
|
d.Set("location", resp.Location)
|
||||||
d.Set("gateway_address", resp.Properties.GatewayIPAddress)
|
d.Set("gateway_address", resp.Properties.GatewayIPAddress)
|
||||||
|
|
|
@ -56,7 +56,6 @@ func testCheckAzureRMLocalNetworkGatewayExists(name string) resource.TestCheckFu
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
return fmt.Errorf("Local network gateway '%s' (resource group '%s') does not exist on Azure.", localNetName, resGrp)
|
return fmt.Errorf("Local network gateway '%s' (resource group '%s') does not exist on Azure.", localNetName, resGrp)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("Error reading the state of local network gateway '%s'.", localNetName)
|
return fmt.Errorf("Error reading the state of local network gateway '%s'.", localNetName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,13 +245,13 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
|
||||||
name := id.Path["networkInterfaces"]
|
name := id.Path["networkInterfaces"]
|
||||||
|
|
||||||
resp, err := ifaceClient.Get(resGroup, name, "")
|
resp, err := ifaceClient.Get(resGroup, name, "")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Network Interface %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Network Interface %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
iface := *resp.Properties
|
iface := *resp.Properties
|
||||||
|
|
||||||
|
|
|
@ -191,13 +191,13 @@ func resourceArmNetworkSecurityGroupRead(d *schema.ResourceData, meta interface{
|
||||||
name := id.Path["networkSecurityGroups"]
|
name := id.Path["networkSecurityGroups"]
|
||||||
|
|
||||||
resp, err := secGroupClient.Get(resGroup, name, "")
|
resp, err := secGroupClient.Get(resGroup, name, "")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Network Security Group %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Network Security Group %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.Properties.SecurityRules != nil {
|
if resp.Properties.SecurityRules != nil {
|
||||||
d.Set("security_rule", flattenNetworkSecurityRules(resp.Properties.SecurityRules))
|
d.Set("security_rule", flattenNetworkSecurityRules(resp.Properties.SecurityRules))
|
||||||
|
|
|
@ -175,13 +175,13 @@ func resourceArmNetworkSecurityRuleRead(d *schema.ResourceData, meta interface{}
|
||||||
sgRuleName := id.Path["securityRules"]
|
sgRuleName := id.Path["securityRules"]
|
||||||
|
|
||||||
resp, err := secRuleClient.Get(resGroup, networkSGName, sgRuleName)
|
resp, err := secRuleClient.Get(resGroup, networkSGName, sgRuleName)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Network Security Rule %s: %s", sgRuleName, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Network Security Rule %s: %s", sgRuleName, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Set("access", resp.Properties.Access)
|
d.Set("access", resp.Properties.Access)
|
||||||
d.Set("destination_address_prefix", resp.Properties.DestinationAddressPrefix)
|
d.Set("destination_address_prefix", resp.Properties.DestinationAddressPrefix)
|
||||||
|
|
|
@ -165,13 +165,13 @@ func resourceArmPublicIpRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
name := id.Path["publicIPAddresses"]
|
name := id.Path["publicIPAddresses"]
|
||||||
|
|
||||||
resp, err := publicIPClient.Get(resGroup, name, "")
|
resp, err := publicIPClient.Get(resGroup, name, "")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure public ip %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure public ip %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Set("location", resp.Location)
|
d.Set("location", resp.Location)
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
|
|
|
@ -112,13 +112,13 @@ func resourceArmRouteRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
routeName := id.Path["routes"]
|
routeName := id.Path["routes"]
|
||||||
|
|
||||||
resp, err := routesClient.Get(resGroup, rtName, routeName)
|
resp, err := routesClient.Get(resGroup, rtName, routeName)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Route %s: %s", routeName, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Route %s: %s", routeName, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,13 +142,13 @@ func resourceArmRouteTableRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
name := id.Path["routeTables"]
|
name := id.Path["routeTables"]
|
||||||
|
|
||||||
resp, err := routeTablesClient.Get(resGroup, name, "")
|
resp, err := routeTablesClient.Get(resGroup, name, "")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Route Table %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Route Table %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.Properties.Subnets != nil {
|
if resp.Properties.Subnets != nil {
|
||||||
if len(*resp.Properties.Subnets) > 0 {
|
if len(*resp.Properties.Subnets) > 0 {
|
||||||
|
|
|
@ -112,13 +112,13 @@ func resourceArmServiceBusNamespaceRead(d *schema.ResourceData, meta interface{}
|
||||||
name := id.Path["namespaces"]
|
name := id.Path["namespaces"]
|
||||||
|
|
||||||
resp, err := namespaceClient.Get(resGroup, name)
|
resp, err := namespaceClient.Get(resGroup, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure ServiceBus Namespace %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure ServiceBus Namespace %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
d.Set("sku", strings.ToLower(string(resp.Sku.Name)))
|
d.Set("sku", strings.ToLower(string(resp.Sku.Name)))
|
||||||
|
|
|
@ -256,14 +256,13 @@ func resourceArmStorageAccountRead(d *schema.ResourceData, meta interface{}) err
|
||||||
|
|
||||||
resp, err := client.GetProperties(resGroup, name)
|
resp, err := client.GetProperties(resGroup, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error reading the state of AzureRM Storage Account %q: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("Error reading the state of AzureRM Storage Account %q: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
keys, err := client.ListKeys(resGroup, name)
|
keys, err := client.ListKeys(resGroup, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -131,13 +131,14 @@ func resourceArmSubnetRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
name := id.Path["subnets"]
|
name := id.Path["subnets"]
|
||||||
|
|
||||||
resp, err := subnetClient.Get(resGroup, vnetName, name, "")
|
resp, err := subnetClient.Get(resGroup, vnetName, name, "")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Subnet %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Subnet %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.Properties.IPConfigurations != nil && len(*resp.Properties.IPConfigurations) > 0 {
|
if resp.Properties.IPConfigurations != nil && len(*resp.Properties.IPConfigurations) > 0 {
|
||||||
ips := make([]string, 0, len(*resp.Properties.IPConfigurations))
|
ips := make([]string, 0, len(*resp.Properties.IPConfigurations))
|
||||||
|
|
|
@ -143,13 +143,14 @@ func resourceArmTemplateDeploymentRead(d *schema.ResourceData, meta interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := deployClient.Get(resGroup, name)
|
resp, err := deployClient.Get(resGroup, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure RM Template Deployment %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure RM Template Deployment %s: %s", name, err)
|
|
||||||
}
|
|
||||||
var outputs map[string]string
|
var outputs map[string]string
|
||||||
if resp.Properties.Outputs != nil && len(*resp.Properties.Outputs) > 0 {
|
if resp.Properties.Outputs != nil && len(*resp.Properties.Outputs) > 0 {
|
||||||
outputs = make(map[string]string)
|
outputs = make(map[string]string)
|
||||||
|
|
|
@ -152,13 +152,14 @@ func resourceArmTrafficManagerEndpointRead(d *schema.ResourceData, meta interfac
|
||||||
name := id.Path[endpointType]
|
name := id.Path[endpointType]
|
||||||
|
|
||||||
resp, err := client.Get(resGroup, profileName, endpointType, name)
|
resp, err := client.Get(resGroup, profileName, endpointType, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on TrafficManager Endpoint %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on TrafficManager Endpoint %s: %s", name, err)
|
|
||||||
}
|
|
||||||
endpoint := *resp.Properties
|
endpoint := *resp.Properties
|
||||||
|
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
|
|
|
@ -150,13 +150,14 @@ func resourceArmTrafficManagerProfileRead(d *schema.ResourceData, meta interface
|
||||||
name := id.Path["trafficManagerProfiles"]
|
name := id.Path["trafficManagerProfiles"]
|
||||||
|
|
||||||
resp, err := client.Get(resGroup, name)
|
resp, err := client.Get(resGroup, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Traffic Manager Profile %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Traffic Manager Profile %s: %s", name, err)
|
|
||||||
}
|
|
||||||
profile := *resp.Properties
|
profile := *resp.Properties
|
||||||
|
|
||||||
// update appropriate values
|
// update appropriate values
|
||||||
|
|
|
@ -485,13 +485,14 @@ func resourceArmVirtualMachineRead(d *schema.ResourceData, meta interface{}) err
|
||||||
name := id.Path["virtualMachines"]
|
name := id.Path["virtualMachines"]
|
||||||
|
|
||||||
resp, err := vmClient.Get(resGroup, name, "")
|
resp, err := vmClient.Get(resGroup, name, "")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Virtual Machine %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Virtual Machine %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.Plan != nil {
|
if resp.Plan != nil {
|
||||||
if err := d.Set("plan", flattenAzureRmVirtualMachinePlan(resp.Plan)); err != nil {
|
if err := d.Set("plan", flattenAzureRmVirtualMachinePlan(resp.Plan)); err != nil {
|
||||||
|
|
|
@ -431,14 +431,14 @@ func resourceArmVirtualMachineScaleSetRead(d *schema.ResourceData, meta interfac
|
||||||
name := id.Path["virtualMachineScaleSets"]
|
name := id.Path["virtualMachineScaleSets"]
|
||||||
|
|
||||||
resp, err := vmScaleSetClient.Get(resGroup, name)
|
resp, err := vmScaleSetClient.Get(resGroup, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure Virtual Machine Scale Set %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
log.Printf("[INFO] AzureRM Virtual Machine Scale Set (%s) Not Found. Removing from State", name)
|
log.Printf("[INFO] AzureRM Virtual Machine Scale Set (%s) Not Found. Removing from State", name)
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure Virtual Machine Scale Set %s: %s", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Set("location", resp.Location)
|
d.Set("location", resp.Location)
|
||||||
d.Set("name", resp.Name)
|
d.Set("name", resp.Name)
|
||||||
|
|
|
@ -132,13 +132,13 @@ func resourceArmVirtualNetworkRead(d *schema.ResourceData, meta interface{}) err
|
||||||
name := id.Path["virtualNetworks"]
|
name := id.Path["virtualNetworks"]
|
||||||
|
|
||||||
resp, err := vnetClient.Get(resGroup, name, "")
|
resp, err := vnetClient.Get(resGroup, name, "")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure virtual network %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure virtual network %s: %s", name, err)
|
|
||||||
}
|
|
||||||
vnet := *resp.Properties
|
vnet := *resp.Properties
|
||||||
|
|
||||||
// update appropriate values
|
// update appropriate values
|
||||||
|
|
|
@ -123,13 +123,14 @@ func resourceArmVirtualNetworkPeeringRead(d *schema.ResourceData, meta interface
|
||||||
name := id.Path["virtualNetworkPeerings"]
|
name := id.Path["virtualNetworkPeerings"]
|
||||||
|
|
||||||
resp, err := client.Get(resGroup, vnetName, name)
|
resp, err := client.Get(resGroup, vnetName, name)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err)
|
||||||
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err)
|
|
||||||
}
|
|
||||||
peer := *resp.Properties
|
peer := *resp.Properties
|
||||||
|
|
||||||
// update appropriate values
|
// update appropriate values
|
||||||
|
|
Loading…
Reference in New Issue