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

[pull] main from hashicorp:main #152

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ ENHANCEMENTS:
BUG FIXES:

* `azurerm_bot_service` - fixing a bug where `public_network_access_enabled` was always set to `true` in Read func [GH-24255]
* * `azurerm_linux_virtual_machine` - `additional_capabilities.0.ultra_ssd_enabled` can now be added during update [GH-24274]
* `azurerm_logic_app_standard` - update default value of `version` from `~3` which is no longer supported to `~4` [GH-24134]
* `azurerm_windows_virtual_machine` - `additional_capabilities.0.ultra_ssd_enabled` can now be added during update [GH-24274]

## 3.85.0 (December 14, 2023)

Expand Down
3 changes: 2 additions & 1 deletion internal/services/compute/linux_virtual_machine_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,8 @@ func resourceLinuxVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interface
if d.HasChange("additional_capabilities") {
shouldUpdate = true

if d.HasChange("additional_capabilities.0.ultra_ssd_enabled") {
n, _ := d.GetChange("additional_capabilities")
if len(n.([]interface{})) == 0 || d.HasChange("additional_capabilities.0.ultra_ssd_enabled") {
shouldShutDown = true
shouldDeallocate = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,28 @@ func TestAccLinuxVirtualMachine_otherUltraSsdUpdated(t *testing.T) {
})
}

func TestAccLinuxVirtualMachine_otherUltraSsdEmptyToUpdate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test")
r := LinuxVirtualMachineResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.otherUltraSsdEmpty(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.otherUltraSsd(data, false),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("additional_capabilities.0.ultra_ssd_enabled").HasValue("false"),
),
},
})
}

func TestAccLinuxVirtualMachine_otherEncryptionAtHostEnabled(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_linux_virtual_machine", "test")
r := LinuxVirtualMachineResource{}
Expand Down Expand Up @@ -2486,6 +2508,41 @@ resource "azurerm_linux_virtual_machine" "test" {
`, r.template(data), data.RandomInteger, ultraSsdEnabled)
}

func (r LinuxVirtualMachineResource) otherUltraSsdEmpty(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

resource "azurerm_linux_virtual_machine" "test" {
name = "acctestVM-%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
size = "Standard_D2s_v3"
admin_username = "adminuser"
network_interface_ids = [
azurerm_network_interface.test.id,
]
zone = 1

admin_ssh_key {
username = "adminuser"
public_key = local.first_public_key
}

os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}

source_image_reference {
publisher = "Canonical"
offer = "0001-com-ubuntu-server-jammy"
sku = "22_04-lts"
version = "latest"
}
}
`, r.template(data), data.RandomInteger)
}

func (r LinuxVirtualMachineResource) otherEncryptionAtHostEnabled(data acceptance.TestData, enabled bool) string {
return fmt.Sprintf(`
%s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,8 @@ func resourceWindowsVirtualMachineUpdate(d *pluginsdk.ResourceData, meta interfa
if d.HasChange("additional_capabilities") {
shouldUpdate = true

if d.HasChange("additional_capabilities.0.ultra_ssd_enabled") {
n, _ := d.GetChange("additional_capabilities")
if len(n.([]interface{})) == 0 || d.HasChange("additional_capabilities.0.ultra_ssd_enabled") {
shouldShutDown = true
shouldDeallocate = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,28 @@ func TestAccWindowsVirtualMachine_otherUltraSsdUpdated(t *testing.T) {
check.That(data.ResourceName).Key("additional_capabilities.0.ultra_ssd_enabled").HasValue("true"),
),
},
})
}

func TestAccWindowsVirtualMachine_otherUltraSsdEmptyToUpdate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_windows_virtual_machine", "test")
r := WindowsVirtualMachineResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.otherUltraSsdEmpty(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("admin_password"),
{
Config: r.otherUltraSsd(data, false),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("additional_capabilities.0.ultra_ssd_enabled").HasValue("false"),
),
},
})
}

Expand Down Expand Up @@ -2887,6 +2908,37 @@ resource "azurerm_windows_virtual_machine" "test" {
`, r.template(data), ultraSsdEnabled)
}

func (r WindowsVirtualMachineResource) otherUltraSsdEmpty(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

resource "azurerm_windows_virtual_machine" "test" {
name = local.vm_name
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
size = "Standard_D2s_v3"
admin_username = "adminuser"
admin_password = "P@$$w0rd1234!"
network_interface_ids = [
azurerm_network_interface.test.id,
]
zone = 1

os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}

source_image_reference {
publisher = "MicrosoftWindowsServer"
offer = "WindowsServer"
sku = "2016-Datacenter"
version = "latest"
}
}
`, r.template(data))
}

func (r WindowsVirtualMachineResource) otherWinRMHTTP(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
Expand Down
Loading