From 1c4d9733c83d269f6cfca962bb22b1b3d71c53a7 Mon Sep 17 00:00:00 2001 From: Haroon-Dweikat-Ntx Date: Thu, 12 Dec 2024 11:28:50 +0200 Subject: [PATCH] add new attributes [attachmentType, protocol, disks] to Volume Group --- examples/volume_group_v2/main.tf | 49 ++++++++++++++++++++ website/docs/r/volume_group_v2.html.markdown | 44 +++++++++++++++++- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/examples/volume_group_v2/main.tf b/examples/volume_group_v2/main.tf index 1eabe43ae..f26fb7ece 100644 --- a/examples/volume_group_v2/main.tf +++ b/examples/volume_group_v2/main.tf @@ -92,6 +92,55 @@ resource "nutanix_volume_group_v2" "volume_group_example" { } + +# create a volume group with attachement_type , protocol and disks +resource "nutanix_volume_group_v2" "volume_group_example" { + name = var.volume_group_name + description = "Test Create Volume group with spec" + should_load_balance_vm_attachments = false + sharing_status = var.volume_group_sharing_status + target_name = "volumegroup-test-001234" + created_by = "example" + cluster_reference = local.cluster1 + iscsi_features { + enabled_authentications = "CHAP" + target_secret = var.volume_group_target_secret + } + + storage_features { + flash_mode { + is_enabled = true + } + } + usage_type = "USER" + attachment_type = "DIRECT" + protocol = "ISCSI" + disks { + disk_size_bytes = 10 * 1024 * 1024 * 1024 + index = 1 + disk_data_source_reference { + name = "vg-disk-%[1]s" + ext_id = "" + entity_type = "STORAGE_CONTAINER" + uris = ["uri1","uri2"] + } + disk_storage_features { + flash_mode { + is_enabled = false + } + } + } + is_hidden = false + + # ignore changes to target_secret, target secret will not be returned in terraform plan output + lifecycle { + ignore_changes = [ + iscsi_features[0].target_secret + ] + } +} + + ########################## ### Data Sources ########################## diff --git a/website/docs/r/volume_group_v2.html.markdown b/website/docs/r/volume_group_v2.html.markdown index df1e0b7be..72ff0a6d2 100644 --- a/website/docs/r/volume_group_v2.html.markdown +++ b/website/docs/r/volume_group_v2.html.markdown @@ -60,8 +60,16 @@ The following arguments are supported: * `cluster_reference`: -(Required) The UUID of the cluster that will host the Volume Group. * `storage_features`: -(Optional) Storage optimization features which must be enabled on the Volume Group. * `usage_type`: -(Optional) Expected usage type for the Volume Group. This is an indicative hint on how the caller will consume the Volume Group. Valid values are BACKUP_TARGET, INTERNAL, TEMPORARY, USER +* `attachment_type`: -(Optional) The field indicates whether a VG has a VM or an external attachment associated with it. Valid values are : + - EXTERNAL : Volume Group has an external iSCSI or NVMf attachment. + - NONE : Volume Group has no attachment. + - DIRECT : Volume Group has a VM attachment. +* `protocol`: -(Optional) Type of protocol to be used for Volume Group. Valid values are : + - NOT_ASSIGNED : Volume Group does not use any protocol. + - ISCSI : Volume Group uses iSCSI protocol. + - NVMF : Volume Group uses NVMf protocol. * `is_hidden`: -(Optional) Indicates whether the Volume Group is meant to be hidden or not. - +* `disks`: -(Optional) A list of Volume Disks to be attached to the Volume Group. ### Iscsi Features @@ -81,4 +89,36 @@ The flash mode features attribute supports the following: * `is_enabled`: - Indicates whether the flash mode is enabled for the Volume Group. -See detailed information in [Nutanix Volumes V4](https://developers.nutanix.com/api-reference?namespace=volumes&version=v4.0.b1). +### Disks + +The disks attribute supports the following: + +* `index`: - Index of the disk in a Volume Group. This field is optional and immutable. +* `disk_size_bytes`: - ize of the disk in bytes. This field is mandatory during Volume Group creation if a new disk is being created on the storage container. +* `description`: - Volume Disk description. +* `disk_data_source_reference`: -(Required) Disk Data Source Reference. +* `disk_storage_features`: - Storage optimization features which must be enabled on the Volume Disks. This is an optional field. If omitted, the disks will honor the Volume Group specific storage features setting. + + +#### Disk Data Source Reference + +The disk_data_source_reference attribute supports the following: + +* `ext_id`: - The external identifier of the Data Source Reference. +* `name`: - The name of the Data Source Reference.bled for the Volume Group. +* `uris`: - The uri list of the Data Source Reference. +* `entity_type`: - The Entity Type of the Data Source Reference. + +#### Disk Storage Features + +The disk_storage_features attribute supports the following: + +* `flash_mode`: - this field will avoid down migration of data from the hot tier unless the overrides field is specified for the virtual disks. + +##### Flash Mode + +The flash mode features attribute supports the following: + +* `is_enabled`: - Indicates whether the flash mode is enabled for the Volume Group Disk. + +See detailed information in [Nutanix Volumes V4](https://developers.nutanix.com/api-reference?namespace=volumes&version=v4.0.b1#tag/VolumeGroups/operation/createVolumeGroup).