Skip to content

Commit

Permalink
azurerm_iothub_device_update_account- sku forces new (#24324)
Browse files Browse the repository at this point in the history
* `azurerm_iothub_device-update_account`- `sku` forces new now

* remove sku test
  • Loading branch information
ziyeqf authored Jan 3, 2024
1 parent cfd7490 commit 3bdb031
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import (

type IotHubDeviceUpdateAccountResource struct{}

var (
_ sdk.ResourceWithUpdate = IotHubDeviceUpdateAccountResource{}
)
var _ sdk.ResourceWithUpdate = IotHubDeviceUpdateAccountResource{}

type IotHubDeviceUpdateAccountModel struct {
Name string `tfschema:"name"`
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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(`
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/iothub_device_update_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 3bdb031

Please sign in to comment.