provider/azurerm: Additional fixes for upstream breaking changes
More fixes for breaking changes introduced in: https://github.com/Azure/azure-sdk-for-go/pull/258
This commit is contained in:
parent
5912bf25b4
commit
d9c0b3e6bd
|
@ -95,7 +95,7 @@ func testCheckAzureRMAvailabilitySetDestroy(s *terraform.State) error {
|
||||||
name := rs.Primary.Attributes["name"]
|
name := rs.Primary.Attributes["name"]
|
||||||
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, name)
|
resp, err := conn.Get(resourceGroup, name, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -176,7 +176,7 @@ func resourceArmNetworkSecurityGroupRead(d *schema.ResourceData, meta interface{
|
||||||
resGroup := id.ResourceGroup
|
resGroup := id.ResourceGroup
|
||||||
name := id.Path["networkSecurityGroups"]
|
name := id.Path["networkSecurityGroups"]
|
||||||
|
|
||||||
resp, err := secGroupClient.Get(resGroup, name)
|
resp, err := secGroupClient.Get(resGroup, name, "")
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
|
@ -220,7 +220,7 @@ func resourceArmNetworkSecurityGroupRuleHash(v interface{}) int {
|
||||||
|
|
||||||
func securityGroupStateRefreshFunc(client *ArmClient, resourceGroupName string, securityGroupName string) resource.StateRefreshFunc {
|
func securityGroupStateRefreshFunc(client *ArmClient, resourceGroupName string, securityGroupName string) resource.StateRefreshFunc {
|
||||||
return func() (interface{}, string, error) {
|
return func() (interface{}, string, error) {
|
||||||
res, err := client.secGroupClient.Get(resourceGroupName, securityGroupName)
|
res, err := client.secGroupClient.Get(resourceGroupName, securityGroupName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("Error issuing read request in securityGroupStateRefreshFunc to Azure ARM for network security group '%s' (RG: '%s'): %s", securityGroupName, resourceGroupName, err)
|
return nil, "", fmt.Errorf("Error issuing read request in securityGroupStateRefreshFunc to Azure ARM for network security group '%s' (RG: '%s'): %s", securityGroupName, resourceGroupName, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ func testCheckAzureRMNetworkSecurityGroupExists(name string) resource.TestCheckF
|
||||||
|
|
||||||
conn := testAccProvider.Meta().(*ArmClient).secGroupClient
|
conn := testAccProvider.Meta().(*ArmClient).secGroupClient
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, sgName)
|
resp, err := conn.Get(resourceGroup, sgName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Bad: Get on secGroupClient: %s", err)
|
return fmt.Errorf("Bad: Get on secGroupClient: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ func testCheckAzureRMNetworkSecurityGroupDestroy(s *terraform.State) error {
|
||||||
name := rs.Primary.Attributes["name"]
|
name := rs.Primary.Attributes["name"]
|
||||||
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, name)
|
resp, err := conn.Get(resourceGroup, name, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -159,7 +159,7 @@ func resourceArmPublicIpRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
resGroup := id.ResourceGroup
|
resGroup := id.ResourceGroup
|
||||||
name := id.Path["publicIPAddresses"]
|
name := id.Path["publicIPAddresses"]
|
||||||
|
|
||||||
resp, err := publicIPClient.Get(resGroup, name)
|
resp, err := publicIPClient.Get(resGroup, name, "")
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
|
@ -196,7 +196,7 @@ func resourceArmPublicIpDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
func publicIPStateRefreshFunc(client *ArmClient, resourceGroupName string, publicIpName string) resource.StateRefreshFunc {
|
func publicIPStateRefreshFunc(client *ArmClient, resourceGroupName string, publicIpName string) resource.StateRefreshFunc {
|
||||||
return func() (interface{}, string, error) {
|
return func() (interface{}, string, error) {
|
||||||
res, err := client.publicIPClient.Get(resourceGroupName, publicIpName)
|
res, err := client.publicIPClient.Get(resourceGroupName, publicIpName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("Error issuing read request in publicIPStateRefreshFunc to Azure ARM for public ip '%s' (RG: '%s'): %s", publicIpName, resourceGroupName, err)
|
return nil, "", fmt.Errorf("Error issuing read request in publicIPStateRefreshFunc to Azure ARM for public ip '%s' (RG: '%s'): %s", publicIpName, resourceGroupName, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ func testCheckAzureRMPublicIpExists(name string) resource.TestCheckFunc {
|
||||||
|
|
||||||
conn := testAccProvider.Meta().(*ArmClient).publicIPClient
|
conn := testAccProvider.Meta().(*ArmClient).publicIPClient
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, availSetName)
|
resp, err := conn.Get(resourceGroup, availSetName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Bad: Get on publicIPClient: %s", err)
|
return fmt.Errorf("Bad: Get on publicIPClient: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ func testCheckAzureRMPublicIpDestroy(s *terraform.State) error {
|
||||||
name := rs.Primary.Attributes["name"]
|
name := rs.Primary.Attributes["name"]
|
||||||
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, name)
|
resp, err := conn.Get(resourceGroup, name, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -125,7 +125,7 @@ func resourceArmVirtualNetworkRead(d *schema.ResourceData, meta interface{}) err
|
||||||
resGroup := id.ResourceGroup
|
resGroup := id.ResourceGroup
|
||||||
name := id.Path["virtualNetworks"]
|
name := id.Path["virtualNetworks"]
|
||||||
|
|
||||||
resp, err := vnetClient.Get(resGroup, name)
|
resp, err := vnetClient.Get(resGroup, name, "")
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
|
@ -208,7 +208,7 @@ func getVirtualNetworkProperties(d *schema.ResourceData) *network.VirtualNetwork
|
||||||
subnetObj.Properties.AddressPrefix = &prefix
|
subnetObj.Properties.AddressPrefix = &prefix
|
||||||
|
|
||||||
if secGroup != "" {
|
if secGroup != "" {
|
||||||
subnetObj.Properties.NetworkSecurityGroup = &network.SubResource{
|
subnetObj.Properties.NetworkSecurityGroup = &network.SecurityGroup{
|
||||||
ID: &secGroup,
|
ID: &secGroup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ func resourceAzureSubnetHash(v interface{}) int {
|
||||||
|
|
||||||
func virtualNetworkStateRefreshFunc(client *ArmClient, resourceGroupName string, networkName string) resource.StateRefreshFunc {
|
func virtualNetworkStateRefreshFunc(client *ArmClient, resourceGroupName string, networkName string) resource.StateRefreshFunc {
|
||||||
return func() (interface{}, string, error) {
|
return func() (interface{}, string, error) {
|
||||||
res, err := client.vnetClient.Get(resourceGroupName, networkName)
|
res, err := client.vnetClient.Get(resourceGroupName, networkName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("Error issuing read request in virtualNetworkStateRefreshFunc to Azure ARM for virtual network '%s' (RG: '%s'): %s", networkName, resourceGroupName, err)
|
return nil, "", fmt.Errorf("Error issuing read request in virtualNetworkStateRefreshFunc to Azure ARM for virtual network '%s' (RG: '%s'): %s", networkName, resourceGroupName, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ func testCheckAzureRMVirtualNetworkExists(name string) resource.TestCheckFunc {
|
||||||
// Ensure resource group/virtual network combination exists in API
|
// Ensure resource group/virtual network combination exists in API
|
||||||
conn := testAccProvider.Meta().(*ArmClient).vnetClient
|
conn := testAccProvider.Meta().(*ArmClient).vnetClient
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, virtualNetworkName)
|
resp, err := conn.Get(resourceGroup, virtualNetworkName, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Bad: Get on vnetClient: %s", err)
|
return fmt.Errorf("Bad: Get on vnetClient: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ func testCheckAzureRMVirtualNetworkDestroy(s *terraform.State) error {
|
||||||
name := rs.Primary.Attributes["name"]
|
name := rs.Primary.Attributes["name"]
|
||||||
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
resourceGroup := rs.Primary.Attributes["resource_group_name"]
|
||||||
|
|
||||||
resp, err := conn.Get(resourceGroup, name)
|
resp, err := conn.Get(resourceGroup, name, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue