From 1dfdba3f9197de8da2ffc38c9c78a759452f7670 Mon Sep 17 00:00:00 2001 From: Abhishek Chaudhary Date: Fri, 27 Oct 2023 22:17:40 +0530 Subject: [PATCH] Feat/1.9.4 (#645) Co-authored-by: Frederic M <43849398+fad3t@users.noreply.github.com> Co-authored-by: ArtemProt Co-authored-by: Abhishekism9450 <32683845+Abhishekism9450@users.noreply.github.com> --- CHANGELOG.md | 22 +++++++++++++++++ README.md | 4 +++- ...urce_nutanix_access_control_policy_test.go | 2 ++ nutanix/resource_nutanix_virtual_machine.go | 24 +++++++++++-------- .../resource_nutanix_virtual_machine_test.go | 4 ++-- website/docs/d/subnets.html.markdown | 6 +++++ website/docs/r/vpc.html.markdown | 8 +++---- 7 files changed, 53 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d1f812bb..e26aa5f3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +## 1.9.4 (October 27, 2023) +[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/feat/1.9.3...feat/1.9.4) + +- Feat branch. [\#645](https://github.com/nutanix/terraform-provider-nutanix/pull/645) + +**Merged pull request:** +- Change VM name should not require VM PowerOFF. [\#626](https://github.com/nutanix/terraform-provider-nutanix/pull/626) +- Fix: compare bootconfig against previous value. [\#641](https://github.com/nutanix/terraform-provider-nutanix/pull/641) + +**Implemented enhancements:** +- Added example to use metadata in nutanix subnets. [\#643](https://github.com/nutanix/terraform-provider-nutanix/pull/643) +- External subnet name/uuid are Optional args not Required. [\#644](https://github.com/nutanix/terraform-provider-nutanix/pull/644) + +**Fixed bugs:** +- VM rebooted at every change because of hotPlugChange set to false. [\#640](https://github.com/nutanix/terraform-provider-nutanix/issues/640) +- Changing the VM name forces a reboot. [\#625](https://github.com/nutanix/terraform-provider-nutanix/issues/625) + +**Closed issues:** +- Modify Terraform documentation for nutanix_vpc resource. [\#636](https://github.com/nutanix/terraform-provider-nutanix/issues/636) +- Include metadata example for data.nutanix_subnets. [\#590](https://github.com/nutanix/terraform-provider-nutanix/issues/590) + + ## 1.9.3 (September 7, 2023) [Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/feat/1.9.2...feat/1.9.3) diff --git a/README.md b/README.md index b08a5c1c4..7c6cfdf9a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Terraform provider plugin to integrate with Nutanix Enterprise Cloud -NOTE: The latest version of the Nutanix provider is [v1.9.3](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.9.3) +NOTE: The latest version of the Nutanix provider is [v1.9.4](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.9.4) Modules based on Terraform Nutanix Provider can be found here : [Modules](https://github.com/nutanix/terraform-provider-nutanix/tree/master/modules) ## Build, Quality Status @@ -52,6 +52,8 @@ The Terraform Nutanix provider is designed to work with Nutanix Prism Central an > For the 1.9.0 release of the provider it will have N-1 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc2022.9 and pc2023.1.0.1. +> For the 1.9.4 release of the provider it will have N-2 compatibility with the Prism Central APIs. This release was tested against Prism Central versions pc2023.3, pc2023.1.0.2 and pc2023.1.0.1. + ### note With v1.6.1 release of flow networking feature in provider, IAMv2 setups would be mandate. Also, there is known issue for access_control_policies resource where update would be failing. We are continuously tracking the issue internally. diff --git a/nutanix/resource_nutanix_access_control_policy_test.go b/nutanix/resource_nutanix_access_control_policy_test.go index f7d6d3cb6..116da07ab 100644 --- a/nutanix/resource_nutanix_access_control_policy_test.go +++ b/nutanix/resource_nutanix_access_control_policy_test.go @@ -14,6 +14,7 @@ import ( const resourceAccessPolicy = "nutanix_access_control_policy.test" func TestAccNutanixAccessControlPolicy_basic(t *testing.T) { + t.Skip() // https://jira.nutanix.com/browse/ENG-483192 name := acctest.RandomWithPrefix("accest-access-policy") roleName := acctest.RandomWithPrefix("test-acc-role") description := "Description of my access control policy" @@ -88,6 +89,7 @@ func TestAccNutanixAccessControlPolicy_WithUser(t *testing.T) { } func TestAccNutanixAccessControlPolicy_WithCategory(t *testing.T) { + t.Skip() //https://jira.nutanix.com/browse/ENG-483192 name := acctest.RandomWithPrefix("accest-access-policy") roleName := acctest.RandomWithPrefix("test-acc-role-") description := "Description of my access control policy" diff --git a/nutanix/resource_nutanix_virtual_machine.go b/nutanix/resource_nutanix_virtual_machine.go index c6926a5e6..6d5f6e382 100644 --- a/nutanix/resource_nutanix_virtual_machine.go +++ b/nutanix/resource_nutanix_virtual_machine.go @@ -965,7 +965,6 @@ func resourceNutanixVirtualMachineUpdate(ctx context.Context, d *schema.Resource if d.HasChange("name") { _, n := d.GetChange("name") spec.Name = utils.StringPtr(n.(string)) - hotPlugChange = false } spec.Description = response.Status.Description @@ -1177,8 +1176,12 @@ func resourceNutanixVirtualMachineUpdate(ctx context.Context, d *schema.Resource } res.PowerStateMechanism = pw - if bc, change := bootConfigHasChange(res.BootConfig, d); !reflect.DeepEqual(*bc, v3.VMBootConfig{}) { - res.BootConfig = bc + currentBootConfig := &v3.VMBootConfig{} + if res.BootConfig != nil { + *currentBootConfig = *res.BootConfig + } + if newBootConfig, change := bootConfigHasChange(currentBootConfig, d); !reflect.DeepEqual(*newBootConfig, *currentBootConfig) { + res.BootConfig = newBootConfig hotPlugChange = change } @@ -1251,19 +1254,20 @@ func getVMSpecVersion(conn *v3.Client, vmID string) (*int64, error) { func bootConfigHasChange(boot *v3.VMBootConfig, d *schema.ResourceData) (*v3.VMBootConfig, bool) { hotPlugChange := false - if boot == nil { - boot = &v3.VMBootConfig{} + bootConfig := &v3.VMBootConfig{} + if boot != nil { + *bootConfig = *boot } if d.HasChange("boot_device_order_list") { _, n := d.GetChange("boot_device_order_list") - boot.BootDeviceOrderList = expandStringList(n.([]interface{})) + bootConfig.BootDeviceOrderList = expandStringList(n.([]interface{})) hotPlugChange = false } if d.HasChange("boot_type") { _, n := d.GetChange("boot_type") - boot.BootType = utils.StringPtr(n.(string)) + bootConfig.BootType = utils.StringPtr(n.(string)) hotPlugChange = false } @@ -1284,13 +1288,13 @@ func bootConfigHasChange(boot *v3.VMBootConfig, d *schema.ResourceData) (*v3.VMB bd.MacAddress = utils.StringPtr(n.(string)) hotPlugChange = false } - boot.BootDevice = bd + bootConfig.BootDevice = bd if dska.AdapterType == nil && dska.DeviceIndex == nil && bd.MacAddress == nil { - boot.BootDevice = nil + bootConfig.BootDevice = nil } - return boot, hotPlugChange + return bootConfig, hotPlugChange } func changePowerState(ctx context.Context, conn *v3.Client, id string, powerState string) error { diff --git a/nutanix/resource_nutanix_virtual_machine_test.go b/nutanix/resource_nutanix_virtual_machine_test.go index 4cd32b601..0d7ab9d6c 100644 --- a/nutanix/resource_nutanix_virtual_machine_test.go +++ b/nutanix/resource_nutanix_virtual_machine_test.go @@ -571,8 +571,8 @@ func TestAccNutanixVirtualMachine_SecureBoot(t *testing.T) { desc := "this is vm desc" updatedName := fmt.Sprintf("test-vm-%d-updated", r) updatedDesc := "this is updated desc" - memory := "200" - updatedMem := "300" + memory := "1024" + updatedMem := "2048" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, diff --git a/website/docs/d/subnets.html.markdown b/website/docs/d/subnets.html.markdown index 82e5c9d24..de2856e79 100644 --- a/website/docs/d/subnets.html.markdown +++ b/website/docs/d/subnets.html.markdown @@ -14,6 +14,12 @@ Describes a list of subnets ```hcl data "nutanix_subnets" "subnets" {} + +data "nutanix_subnets" "test" { + metadata { + filter = "name==vlan0_test_2" + } +} ``` ## Attribute Reference diff --git a/website/docs/r/vpc.html.markdown b/website/docs/r/vpc.html.markdown index 40256289f..9c5f48eeb 100644 --- a/website/docs/r/vpc.html.markdown +++ b/website/docs/r/vpc.html.markdown @@ -67,10 +67,10 @@ resource "nutanix_vpc" "vpc" { The following arguments are supported: * `name` - (Required) The name for the VPC. -* `external_subnet_reference_uuid` - (Required) List of external subnets uuid attached to this VPC. Should not be used with external_subnet_reference_name. -* `external_subnet_reference_name` - (Required) List of external subnets name attached to this VPC. Should not be used with external_subnet_reference_uuid. -* `externally_routable_prefix_list` - (Optional) List Externally Routable IP Addresses. Required when external subnet with NoNAT is used. -* `common_domain_name_server_ip_list` - (Optional) List of domain name server IPs. +* `external_subnet_reference_uuid` - (Optional) List of external subnets uuid attached to this VPC. Should not be used with external_subnet_reference_name. +* `external_subnet_reference_name` - (Optional) List of external subnets name attached to this VPC. Should not be used with external_subnet_reference_uuid. +* `externally_routable_prefix_list` - (Optional) List Externally Routable IP Addresses. Required when external subnet with NoNAT is used. +* `common_domain_name_server_ip_list` - (Optional) List of domain name server IPs. ## externally_routable_prefix_list Externally Routable IP Addresses