Skip to content

Commit 82a4cf8

Browse files
WodansSonkatbyte
andauthored
Splitting SDK upgrade and OVMSS work into two PR's (hashicorp#14174)
Co-authored-by: kt <kt@katbyte.me>
1 parent bf14645 commit 82a4cf8

File tree

114 files changed

+17598
-6353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+17598
-6353
lines changed

internal/services/compute/availability_set_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"time"
99

10-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
10+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
1111
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1212
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1313
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"

internal/services/compute/client/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package client
22

33
import (
4-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
4+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
55
"github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering"
66
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
77
)

internal/services/compute/dedicated_host_group_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"

internal/services/compute/dedicated_host_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"log"
77
"time"
88

9-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
9+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
1010
"github.com/hashicorp/go-azure-helpers/lang/response"
1111
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1212
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"

internal/services/compute/disk_access_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"

internal/services/compute/disk_encryption_set_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"log"
77
"time"
88

9-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
9+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1111
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1212
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"

internal/services/compute/encryption_settings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package compute
22

33
import (
4-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
4+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
55
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
66
"github.com/hashicorp/terraform-provider-azurerm/utils"
77
)

internal/services/compute/helpers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package compute
22

33
import (
4-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
4+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
55
"github.com/hashicorp/terraform-provider-azurerm/utils"
66
)
77

internal/services/compute/image_data_source.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sort"
88
"time"
99

10-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
10+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
1111
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1212
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
1313
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"

internal/services/compute/image_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"

internal/services/compute/image_resource_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ func (ImageResource) generalizeVirtualMachine(data acceptance.TestData) func(con
280280
}
281281

282282
log.Printf("[DEBUG] Deallocating VM..")
283-
future, err := client.Compute.VMClient.Deallocate(ctx, id.ResourceGroup, id.Name)
283+
// Upgrading to the 2021-07-01 exposed a new hibernate parameter in the GET method
284+
future, err := client.Compute.VMClient.Deallocate(ctx, id.ResourceGroup, id.Name, utils.Bool(false))
284285
if err != nil {
285286
return fmt.Errorf("Bad: deallocating vm: %+v", err)
286287
}
@@ -322,7 +323,8 @@ func (ImageResource) virtualMachineScaleSetExists(ctx context.Context, client *c
322323
return err
323324
}
324325

325-
resp, err := client.Compute.VMScaleSetClient.Get(ctx, id.ResourceGroup, id.Name)
326+
// Upgrading to the 2021-07-01 exposed a new expand parameter in the GET method
327+
resp, err := client.Compute.VMScaleSetClient.Get(ctx, id.ResourceGroup, id.Name, "")
326328
if err != nil {
327329
if utils.ResponseWasNotFound(resp.Response) {
328330
return fmt.Errorf("%s does not exist", *id)

internal/services/compute/images_data_source.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/location"

internal/services/compute/linux_virtual_machine_resource.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"time"
99

10-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
10+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
1111
"github.com/hashicorp/go-azure-helpers/lang/response"
1212
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1313
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
@@ -1039,7 +1039,8 @@ func resourceLinuxVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interface
10391039
if shouldDeallocate {
10401040
if !hasEphemeralOSDisk {
10411041
log.Printf("[DEBUG] Deallocating Linux Virtual Machine %q (Resource Group %q)..", id.Name, id.ResourceGroup)
1042-
future, err := client.Deallocate(ctx, id.ResourceGroup, id.Name)
1042+
// Upgrade to 2021-07-01 added a hibernate parameter to this call defaulting to false
1043+
future, err := client.Deallocate(ctx, id.ResourceGroup, id.Name, utils.Bool(false))
10431044
if err != nil {
10441045
return fmt.Errorf("Deallocating Linux Virtual Machine %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
10451046
}

internal/services/compute/linux_virtual_machine_scale_set_resource.go

+21-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1111
azValidate "github.com/hashicorp/terraform-provider-azurerm/helpers/validate"
@@ -282,7 +282,8 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta i
282282
resourceGroup := d.Get("resource_group_name").(string)
283283
name := d.Get("name").(string)
284284

285-
exists, err := client.Get(ctx, resourceGroup, name)
285+
// Upgrading to the 2021-07-01 exposed a new expand parameter to the GET method
286+
exists, err := client.Get(ctx, resourceGroup, name, compute.ExpandTypesForGetVMScaleSetsUserData)
286287
if err != nil {
287288
if !utils.ResponseWasNotFound(exists.Response) {
288289
return fmt.Errorf("checking for existing Linux Virtual Machine Scale Set %q (Resource Group %q): %+v", name, resourceGroup, err)
@@ -345,16 +346,16 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta i
345346
rollingUpgradePolicy := ExpandVirtualMachineScaleSetRollingUpgradePolicy(rollingUpgradePolicyRaw)
346347

347348
if upgradeMode != compute.UpgradeModeAutomatic && len(automaticOSUpgradePolicyRaw) > 0 {
348-
return fmt.Errorf("An `automatic_os_upgrade_policy` block cannot be specified when `upgrade_mode` is not set to `Automatic`")
349+
return fmt.Errorf("an `automatic_os_upgrade_policy` block cannot be specified when `upgrade_mode` is not set to `Automatic`")
349350
}
350351

351352
shouldHaveRollingUpgradePolicy := upgradeMode == compute.UpgradeModeAutomatic || upgradeMode == compute.UpgradeModeRolling
352353
if !shouldHaveRollingUpgradePolicy && len(rollingUpgradePolicyRaw) > 0 {
353-
return fmt.Errorf("A `rolling_upgrade_policy` block cannot be specified when `upgrade_mode` is set to %q", string(upgradeMode))
354+
return fmt.Errorf("a `rolling_upgrade_policy` block cannot be specified when `upgrade_mode` is set to %q", string(upgradeMode))
354355
}
355356
shouldHaveRollingUpgradePolicy = upgradeMode == compute.UpgradeModeRolling
356357
if shouldHaveRollingUpgradePolicy && len(rollingUpgradePolicyRaw) == 0 {
357-
return fmt.Errorf("A `rolling_upgrade_policy` block must be specified when `upgrade_mode` is set to %q", string(upgradeMode))
358+
return fmt.Errorf("a `rolling_upgrade_policy` block must be specified when `upgrade_mode` is set to %q", string(upgradeMode))
358359
}
359360

360361
secretsRaw := d.Get("secret").([]interface{})
@@ -461,16 +462,16 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta i
461462

462463
// Azure API: "Authentication using either SSH or by user name and password must be enabled in Linux profile."
463464
if disablePasswordAuthentication && virtualMachineProfile.OsProfile.AdminPassword == nil && len(sshKeys) == 0 {
464-
return fmt.Errorf("At least one SSH key must be specified if `disable_password_authentication` is enabled")
465+
return fmt.Errorf("at least one SSH key must be specified if `disable_password_authentication` is enabled")
465466
}
466467

467468
if evictionPolicyRaw, ok := d.GetOk("eviction_policy"); ok {
468469
if virtualMachineProfile.Priority != compute.VirtualMachinePriorityTypesSpot {
469-
return fmt.Errorf("An `eviction_policy` can only be specified when `priority` is set to `Spot`")
470+
return fmt.Errorf("an `eviction_policy` can only be specified when `priority` is set to `Spot`")
470471
}
471472
virtualMachineProfile.EvictionPolicy = compute.VirtualMachineEvictionPolicyTypes(evictionPolicyRaw.(string))
472473
} else if priority == compute.VirtualMachinePriorityTypesSpot {
473-
return fmt.Errorf("An `eviction_policy` must be specified when `priority` is set to `Spot`")
474+
return fmt.Errorf("an `eviction_policy` must be specified when `priority` is set to `Spot`")
474475
}
475476

476477
if v, ok := d.GetOk("terminate_notification"); ok {
@@ -501,6 +502,10 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta i
501502
SinglePlacementGroup: utils.Bool(d.Get("single_placement_group").(bool)),
502503
VirtualMachineProfile: &virtualMachineProfile,
503504
UpgradePolicy: &upgradePolicy,
505+
// OrchestrationMode needs to be hardcoded to Uniform, for the
506+
// standard VMSS resource, since virtualMachineProfile is now supported
507+
// in both VMSS and Orchestrated VMSS...
508+
OrchestrationMode: compute.OrchestrationModeUniform,
504509
ScaleInPolicy: &compute.ScaleInPolicy{
505510
Rules: &[]compute.VirtualMachineScaleSetScaleInRules{compute.VirtualMachineScaleSetScaleInRules(scaleInPolicy)},
506511
},
@@ -539,7 +544,8 @@ func resourceLinuxVirtualMachineScaleSetCreate(d *pluginsdk.ResourceData, meta i
539544
log.Printf("[DEBUG] Virtual Machine Scale Set %q (Resource Group %q) was created", name, resourceGroup)
540545

541546
log.Printf("[DEBUG] Retrieving Virtual Machine Scale Set %q (Resource Group %q)..", name, resourceGroup)
542-
resp, err := client.Get(ctx, resourceGroup, name)
547+
// Upgrading to the 2021-07-01 exposed a new expand parameter to the GET method
548+
resp, err := client.Get(ctx, resourceGroup, name, compute.ExpandTypesForGetVMScaleSetsUserData)
543549
if err != nil {
544550
return fmt.Errorf("retrieving Linux Virtual Machine Scale Set %q (Resource Group %q): %+v", name, resourceGroup, err)
545551
}
@@ -565,7 +571,8 @@ func resourceLinuxVirtualMachineScaleSetUpdate(d *pluginsdk.ResourceData, meta i
565571
updateInstances := false
566572

567573
// retrieve
568-
existing, err := client.Get(ctx, id.ResourceGroup, id.Name)
574+
// Upgrading to the 2021-07-01 exposed a new expand parameter to the GET method
575+
existing, err := client.Get(ctx, id.ResourceGroup, id.Name, compute.ExpandTypesForGetVMScaleSetsUserData)
569576
if err != nil {
570577
return fmt.Errorf("retrieving Linux Virtual Machine Scale Set %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err)
571578
}
@@ -867,7 +874,8 @@ func resourceLinuxVirtualMachineScaleSetRead(d *pluginsdk.ResourceData, meta int
867874
return err
868875
}
869876

870-
resp, err := client.Get(ctx, id.ResourceGroup, id.Name)
877+
// Upgrading to the 2021-07-01 exposed a new expand parameter to the GET method
878+
resp, err := client.Get(ctx, id.ResourceGroup, id.Name, compute.ExpandTypesForGetVMScaleSetsUserData)
871879
if err != nil {
872880
if utils.ResponseWasNotFound(resp.Response) {
873881
log.Printf("[DEBUG] Linux Virtual Machine Scale Set %q was not found in Resource Group %q - removing from state!", id.Name, id.ResourceGroup)
@@ -1074,7 +1082,8 @@ func resourceLinuxVirtualMachineScaleSetDelete(d *pluginsdk.ResourceData, meta i
10741082
return err
10751083
}
10761084

1077-
resp, err := client.Get(ctx, id.ResourceGroup, id.Name)
1085+
// Upgrading to the 2021-07-01 exposed a new expand parameter to the GET method
1086+
resp, err := client.Get(ctx, id.ResourceGroup, id.Name, compute.ExpandTypesForGetVMScaleSetsUserData)
10781087
if err != nil {
10791088
if utils.ResponseWasNotFound(resp.Response) {
10801089
return nil

internal/services/compute/linux_virtual_machine_scale_set_resource_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ func (r LinuxVirtualMachineScaleSetResource) Exists(ctx context.Context, clients
2020
return nil, err
2121
}
2222

23-
resp, err := clients.Compute.VMScaleSetClient.Get(ctx, id.ResourceGroup, id.Name)
23+
// Upgrading to the 2021-07-01 exposed a new expand parameter in the GET method
24+
resp, err := clients.Compute.VMScaleSetClient.Get(ctx, id.ResourceGroup, id.Name, "")
2425
if err != nil {
2526
return nil, fmt.Errorf("retrieving Compute Linux Virtual Machine Scale Set %q: %+v", id, err)
2627
}

internal/services/compute/managed_disk_resource.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
9+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1111
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1212
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
@@ -634,7 +634,8 @@ func resourceManagedDiskUpdate(d *pluginsdk.ResourceData, meta interface{}) erro
634634
// De-allocate
635635
if shouldDeallocate {
636636
log.Printf("[DEBUG] Deallocating Virtual Machine %q (Resource Group %q)..", virtualMachine.Name, virtualMachine.ResourceGroup)
637-
deAllocFuture, err := vmClient.Deallocate(ctx, virtualMachine.ResourceGroup, virtualMachine.Name)
637+
// Upgrading to 2021-07-01 exposed a new hibernate paramater to the Deallocate method
638+
deAllocFuture, err := vmClient.Deallocate(ctx, virtualMachine.ResourceGroup, virtualMachine.Name, utils.Bool(false))
638639
if err != nil {
639640
return fmt.Errorf("Deallocating to Virtual Machine %q (Resource Group %q): %+v", virtualMachine.Name, virtualMachine.ResourceGroup, err)
640641
}

internal/services/compute/managed_disk_resource_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"testing"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1010
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"

internal/services/compute/migration/legacy_vmss.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ func (LegacyVMSSV0ToV1) UpgradeFunc() pluginsdk.StateUpgraderFunc {
700700
resGroup := rawState["resource_group_name"].(string)
701701
name := rawState["name"].(string)
702702

703-
read, err := client.Get(ctx, resGroup, name)
703+
read, err := client.Get(ctx, resGroup, name, "")
704704
if err != nil {
705705
return rawState, err
706706
}

internal/services/compute/network_interface.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package compute
33
import (
44
"context"
55

6-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
6+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
77
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network"
88
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/parse"
99
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"

internal/services/compute/orchestrated_virtual_machine_scale_set_resource.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
@@ -97,7 +97,8 @@ func resourceOrchestratedVirtualMachineScaleSetCreateUpdate(d *pluginsdk.Resourc
9797
name := d.Get("name").(string)
9898

9999
if d.IsNewResource() {
100-
existing, err := client.Get(ctx, resourceGroup, name)
100+
// Upgrading to the 2021-07-01 exposed a new expand parameter to the GET method
101+
existing, err := client.Get(ctx, resourceGroup, name, compute.ExpandTypesForGetVMScaleSetsUserData)
101102
if err != nil {
102103
if !utils.ResponseWasNotFound(existing.Response) {
103104
return fmt.Errorf("checking for existing Orchestrated Virtual Machine Scale Set %q (Resource Group %q): %+v", name, resourceGroup, err)
@@ -134,7 +135,8 @@ func resourceOrchestratedVirtualMachineScaleSetCreateUpdate(d *pluginsdk.Resourc
134135
return fmt.Errorf("waiting for creation of Orchestrated Virtual Machine Scale Set %q (Resource Group %q): %+v", name, resourceGroup, err)
135136
}
136137

137-
resp, err := client.Get(ctx, resourceGroup, name)
138+
// Upgrading to the 2021-07-01 exposed a new expand parameter in the GET method
139+
resp, err := client.Get(ctx, resourceGroup, name, compute.ExpandTypesForGetVMScaleSetsUserData)
138140
if err != nil {
139141
return fmt.Errorf("retrieving Orchestrated Virtual Machine Scale Set %q (Resource Group %q): %+v", name, resourceGroup, err)
140142
}
@@ -157,7 +159,8 @@ func resourceOrchestratedVirtualMachineScaleSetRead(d *pluginsdk.ResourceData, m
157159
return err
158160
}
159161

160-
resp, err := client.Get(ctx, id.ResourceGroup, id.Name)
162+
// Upgrading to the 2021-07-01 exposed a new expand parameter in the GET method
163+
resp, err := client.Get(ctx, id.ResourceGroup, id.Name, compute.ExpandTypesForGetVMScaleSetsUserData)
161164
if err != nil {
162165
if utils.ResponseWasNotFound(resp.Response) {
163166
log.Printf("[DEBUG] Orchestrated Virtual Machine Scale Set %q was not found in Resource Group %q - removing from state!", id.Name, id.ResourceGroup)

internal/services/compute/orchestrated_virtual_machine_scale_set_resource_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (t OrchestratedVirtualMachineScaleSetResource) Exists(ctx context.Context,
9696
return nil, err
9797
}
9898

99-
resp, err := clients.Compute.VMScaleSetClient.Get(ctx, id.ResourceGroup, id.Name)
99+
resp, err := clients.Compute.VMScaleSetClient.Get(ctx, id.ResourceGroup, id.Name, "")
100100
if err != nil {
101101
return nil, fmt.Errorf("retrieving Compute Marketplace Agreement %q", id.String())
102102
}

internal/services/compute/platform_image_data_source.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"time"
66

7-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
7+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
88
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
99
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
1010
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"

internal/services/compute/proximity_placement_group_resource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66
"time"
77

8-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
8+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
99
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
1010
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"

internal/services/compute/shared_image_data_source.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"time"
66

7-
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
7+
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-07-01/compute"
88
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
99
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
1010
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate"

internal/services/compute/shared_image_gallery_data_source.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ func dataSourceSharedImageGalleryRead(d *pluginsdk.ResourceData, meta interface{
5555
name := d.Get("name").(string)
5656
resourceGroup := d.Get("resource_group_name").(string)
5757

58-
resp, err := client.Get(ctx, resourceGroup, name)
58+
// Upgrading to the 2021-07-01 exposed a new expand parameter in the GET method
59+
resp, err := client.Get(ctx, resourceGroup, name, "")
5960
if err != nil {
6061
if utils.ResponseWasNotFound(resp.Response) {
6162
return fmt.Errorf("Shared Image Gallery %q (Resource Group %q) was not found", name, resourceGroup)

0 commit comments

Comments
 (0)