From 3467e494c08a33033f3d1e47c39569affe68d1d7 Mon Sep 17 00:00:00 2001 From: ziyeqf <51212351+ziyeqf@users.noreply.github.com> Date: Mon, 25 Dec 2023 14:15:56 +0800 Subject: [PATCH 1/2] `azurerm_iothub_device-update_account`- `sku` forces new now --- .../iothub/iothub_device_update_account_resource.go | 9 ++------- .../docs/r/iothub_device_update_account.html.markdown | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/services/iothub/iothub_device_update_account_resource.go b/internal/services/iothub/iothub_device_update_account_resource.go index dbb80d8016ff..6092ffb8fcc0 100644 --- a/internal/services/iothub/iothub_device_update_account_resource.go +++ b/internal/services/iothub/iothub_device_update_account_resource.go @@ -21,9 +21,7 @@ import ( type IotHubDeviceUpdateAccountResource struct{} -var ( - _ sdk.ResourceWithUpdate = IotHubDeviceUpdateAccountResource{} -) +var _ sdk.ResourceWithUpdate = IotHubDeviceUpdateAccountResource{} type IotHubDeviceUpdateAccountModel struct { Name string `tfschema:"name"` @@ -58,6 +56,7 @@ func (r IotHubDeviceUpdateAccountResource) Arguments() map[string]*pluginsdk.Sch "sku": { Type: pluginsdk.TypeString, + ForceNew: true, Optional: true, Default: deviceupdates.SKUStandard, ValidateFunc: validation.StringInSlice([]string{ @@ -255,10 +254,6 @@ func (r IotHubDeviceUpdateAccountResource) Update() sdk.ResourceFunc { existing.Properties.PublicNetworkAccess = &publicNetworkAccess } - if metadata.ResourceData.HasChange("sku") { - existing.Properties.Sku = &model.Sku - } - if metadata.ResourceData.HasChange("tags") { existing.Tags = &model.Tags } diff --git a/website/docs/r/iothub_device_update_account.html.markdown b/website/docs/r/iothub_device_update_account.html.markdown index 3f88cddd45c5..a77433ebbfcc 100644 --- a/website/docs/r/iothub_device_update_account.html.markdown +++ b/website/docs/r/iothub_device_update_account.html.markdown @@ -47,7 +47,7 @@ The following arguments are supported: * `public_network_access_enabled` - (Optional) Specifies whether the public network access is enabled for the IoT Hub Device Update Account. Possible values are `true` and `false`. Defaults to `true`. -* `sku` - (Optional) Sku of the IoT Hub Device Update Account. Possible values are `Free` and `Standard`. Defaults to `Standard`. +* `sku` - (Optional) Sku of the IoT Hub Device Update Account. Possible values are `Free` and `Standard`. Defaults to `Standard`. Changing this forces a new resource to be created. * `tags` - (Optional) A mapping of tags which should be assigned to the IoT Hub Device Update Account. From fedb38ba1aa49e81fd1f713bd25bae6ff3836227 Mon Sep 17 00:00:00 2001 From: ziyeqf <51212351+ziyeqf@users.noreply.github.com> Date: Wed, 3 Jan 2024 15:39:07 +0800 Subject: [PATCH 2/2] remove sku test --- ...hub_device_update_account_resource_test.go | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/internal/services/iothub/iothub_device_update_account_resource_test.go b/internal/services/iothub/iothub_device_update_account_resource_test.go index 327cd5e69c22..56b52a7b1766 100644 --- a/internal/services/iothub/iothub_device_update_account_resource_test.go +++ b/internal/services/iothub/iothub_device_update_account_resource_test.go @@ -120,27 +120,6 @@ func TestAccIotHubDeviceUpdateAccount_publicNetworkAccess(t *testing.T) { }) } -func TestAccIotHubDeviceUpdateAccount_sku(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_iothub_device_update_account", "test") - r := IotHubDeviceUpdateAccountResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.sku(data, "Free"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - { - Config: r.sku(data, "Standard"), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - func TestAccIotHubDeviceUpdateAccount_tags(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_iothub_device_update_account", "test") r := IotHubDeviceUpdateAccountResource{} @@ -334,21 +313,6 @@ resource "azurerm_iothub_device_update_account" "test" { `, template, data.RandomString, enabled) } -func (r IotHubDeviceUpdateAccountResource) sku(data acceptance.TestData, sku string) string { - template := r.template(data) - return fmt.Sprintf(` -%s - -resource "azurerm_iothub_device_update_account" "test" { - name = "acc-dua-%s" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - - sku = "%s" -} -`, template, data.RandomString, sku) -} - func (r IotHubDeviceUpdateAccountResource) tags(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(`