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

Update the compute service api-version from 2019-07-01 to 2019-12-01 #7101

Merged
merged 11 commits into from Jun 18, 2020
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/client/client.go
@@ -1,7 +1,7 @@
package client

import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)
Expand Down
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/compute/parse"
azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/schema"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/encryption_settings.go
@@ -1,7 +1,7 @@
package compute

import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/helpers.go
@@ -1,7 +1,7 @@
package compute

import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/image_data_source.go
Expand Up @@ -7,7 +7,7 @@ import (
"sort"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/image_resource.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
6 changes: 3 additions & 3 deletions azurerm/internal/services/compute/managed_disk_resource.go
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down Expand Up @@ -203,7 +203,7 @@ func resourceArmManagedDiskCreateUpdate(d *schema.ResourceData, meta interface{}

if d.HasChange("disk_mbps_read_write") {
v := d.Get("disk_mbps_read_write")
diskMBps := int32(v.(int))
diskMBps := int64(v.(int))
props.DiskMBpsReadWrite = &diskMBps
}
} else if d.HasChange("disk_iops_read_write") || d.HasChange("disk_mbps_read_write") {
Expand Down Expand Up @@ -341,7 +341,7 @@ func resourceArmManagedDiskUpdate(d *schema.ResourceData, meta interface{}) erro

if d.HasChange("disk_mbps_read_write") {
v := d.Get("disk_mbps_read_write")
diskMBps := int32(v.(int))
diskMBps := int64(v.(int))
diskUpdate.DiskMBpsReadWrite = &diskMBps
}
} else if d.HasChange("disk_iops_read_write") || d.HasChange("disk_mbps_read_write") {
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/network_interface.go
Expand Up @@ -3,7 +3,7 @@ package compute
import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-03-01/network"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network/parse"
Expand Down
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down Expand Up @@ -59,9 +59,12 @@ func resourceArmOrchestratedVirtualMachineScaleSet() *schema.Resource {
},

"single_placement_group": {
Type: schema.TypeBool,
Required: true,
ForceNew: true,
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
Deprecated: "Due to an upgrade of the compute API this preview property has now been deprecated and required to be false in the 2019-12-01 api versions for orchestrated VMSS - as it will always be false for the current and future API versions this property now defaults to false and will removed in version 3.0 of the provider.",
ValidateFunc: validateBoolIsFalse,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change - previously this could be set to true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tom, I'm the Microsoft PM behind this feature, working with @ArcturusZhang to expose to Terraform. I can confirm that for this preview feature, we changed from true to false to support an update of the technology stack. We don't have any customers using spg=true for this preview at the moment, but we do have customers waiting for spg=false.

Would it be ok to allow this value to be true or false, and just pass the value to Azure to do the validation? Happy to discuss or talk through whatever needed so that we can get this out ASAP

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fitzgeraldsteele - right now the property is forced to be true in terraform so anyone using the resource would have spg=true, and to date the previous API version still works with spg=true - are you saying absolutely no one is currently using orchestrated VMSSs via terraform at this time?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(its been released so anyone could be using it atm)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the usage data now. We are closing/discontinuing the preview that uses spg=true, and are working to unblock customers using spg=false. Our documentation will have this update. If we document that in the changelog here, can we bring this back into the 2.14 release?

Happy to have a non-github discussion...I don't want to post the usage data here. :) jerry steele @ microsoft

},

// the VMO mode can only be deployed into one zone for now, and its zone will also be assigned to all its VM instances
Expand Down Expand Up @@ -189,3 +192,17 @@ func resourceArmOrchestratedVirtualMachineScaleSetDelete(d *schema.ResourceData,

return nil
}

func validateBoolIsFalse(i interface{}, k string) (warnings []string, errors []error) {
v, ok := i.(bool)
if !ok {
errors = append(errors, fmt.Errorf("expected type of %s to be boolean", k))
return
}

if v {
errors = append(errors, fmt.Errorf("%q can only be false", k))
}

return
}
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
Expand Down
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
Expand Down
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/shared_image_resource.go
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
Expand Down
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
Expand Down
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/shared_schema.go
Expand Up @@ -3,7 +3,7 @@ package compute
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/snapshot_resource.go
Expand Up @@ -6,7 +6,7 @@ import (
"regexp"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/internal/services/compute/ssh_keys.go
Expand Up @@ -9,7 +9,7 @@ import (

"golang.org/x/crypto/ssh"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
Expand Up @@ -81,10 +81,7 @@ func TestAccAzureRMLinuxVirtualMachine_orchestratedMultipleNonZonal(t *testing.T
}

func testAccAzureRMLinuxVirtualMachine_orchestratedZonal(data acceptance.TestData) string {
// in VMSS VMO mode, the `platform_fault_domain_count` has different acceptable values for different locations,
// therefore this location is fixed to EastUS2 to make sure the acceptance test has no issues about this value
location := "EastUS2"
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data, location)
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data)
return fmt.Sprintf(`
%s
Expand All @@ -105,8 +102,7 @@ resource "azurerm_orchestrated_virtual_machine_scale_set" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
platform_fault_domain_count = 5
single_placement_group = true
platform_fault_domain_count = 1
zones = ["1"]
Expand Down Expand Up @@ -146,7 +142,7 @@ resource "azurerm_linux_virtual_machine" "test" {
}

func testAccAzureRMLinuxVirtualMachine_orchestratedNonZonal(data acceptance.TestData) string {
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data, data.Locations.Primary)
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data)
return fmt.Sprintf(`
%s
Expand All @@ -168,7 +164,6 @@ resource "azurerm_orchestrated_virtual_machine_scale_set" "test" {
resource_group_name = azurerm_resource_group.test.name
platform_fault_domain_count = 2
single_placement_group = true
tags = {
ENV = "Test"
Expand Down Expand Up @@ -205,10 +200,7 @@ resource "azurerm_linux_virtual_machine" "test" {
}

func testAccAzureRMLinuxVirtualMachine_orchestratedMultipleZonal(data acceptance.TestData) string {
// in VMSS VMO mode, the `platform_fault_domain_count` has different acceptable values for different locations,
// therefore this location is fixed to EastUS2 to make sure the acceptance test has no issues about this value
location := "EastUS2"
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data, location)
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data)
return fmt.Sprintf(`
%s
Expand All @@ -217,8 +209,7 @@ resource "azurerm_orchestrated_virtual_machine_scale_set" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
platform_fault_domain_count = 5
single_placement_group = true
platform_fault_domain_count = 1
zones = ["1"]
Expand Down Expand Up @@ -310,7 +301,7 @@ resource "azurerm_linux_virtual_machine" "another" {
}

func testAccAzureRMLinuxVirtualMachine_orchestratedMultipleNonZonal(data acceptance.TestData) string {
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data, data.Locations.Primary)
template := testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data)
return fmt.Sprintf(`
%s
Expand All @@ -319,10 +310,7 @@ resource "azurerm_orchestrated_virtual_machine_scale_set" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
platform_fault_domain_count = 5
single_placement_group = true
zones = ["1"]
platform_fault_domain_count = 2
tags = {
ENV = "Test"
Expand Down Expand Up @@ -409,7 +397,7 @@ resource "azurerm_linux_virtual_machine" "another" {
`, template, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data acceptance.TestData, location string) string {
func testLinuxVirtualMachine_templateBaseForOchestratedVMSS(data acceptance.TestData) string {
return fmt.Sprintf(`
locals {
vm_name = "acctestvm%s"
Expand All @@ -433,5 +421,5 @@ resource "azurerm_subnet" "test" {
virtual_network_name = azurerm_virtual_network.test.name
address_prefix = "10.0.2.0/24"
}
`, data.RandomString, data.RandomInteger, location, data.RandomInteger)
`, data.RandomString, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance"
Expand Down