Skip to content

Commit

Permalink
docs and examples for associate category to VG
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroon-Dweikat-Ntx committed Jan 21, 2025
1 parent ccd9aa8 commit b0cf6e6
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 1 deletion.
64 changes: 64 additions & 0 deletions examples/associate_category_to_volume_group_v2/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
terraform {
required_providers {
nutanix = {
source = "nutanix/nutanix"
version = "2.1"
}
}
}

#defining nutanix configuration
provider "nutanix" {
username = var.nutanix_username
password = var.nutanix_password
endpoint = var.nutanix_endpoint
port = 9440
insecure = true
}

// Create a volume group
resource "nutanix_volume_group_v2" "example"{
name = "test_volume_group"
description = "Test Volume group with min spec and no Auth"
should_load_balance_vm_attachments = false
sharing_status = "SHARED"
target_name = "volumegroup-test-0"
created_by = "Test"
cluster_reference = "<Cluster uuid>"
iscsi_features {
enabled_authentications = "CHAP"
target_secret = "1234567891011"
}

storage_features {
flash_mode {
is_enabled = true
}
}
usage_type = "USER"
is_hidden = false

lifecycle {
ignore_changes = [
iscsi_features[0].target_secret
]
}
}


# List categories
data "nutanix_categories_v2" "categories"{}

# Associate categories to volume group
resource "nutanix_associate_category_to_volume_group_v2" "example"{
ext_id = nutanix_volume_group_v2.example.id
categories{
ext_id = data.nutanix_categories_v2.categories.categories.0.ext_id
}
categories{
ext_id = data.nutanix_categories_v2.categories.categories.1.ext_id
}
categories{
ext_id = data.nutanix_categories_v2.categories.categories.2.ext_id
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define values to the variables to be used in terraform file
nutanix_username = "admin"
nutanix_password = "password"
nutanix_endpoint = "10.xx.xx.xx"
nutanix_port = 9440
13 changes: 13 additions & 0 deletions examples/associate_category_to_volume_group_v2/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#define the type of variables to be used in terraform file
variable "nutanix_username" {
type = string
}
variable "nutanix_password" {
type = string
}
variable "nutanix_endpoint" {
type = string
}
variable "nutanix_port" {
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ resource "nutanix_associate_category_to_volume_group_v2" "test" {
ext_id = nutanix_volume_group_v2.test.id
categories{
ext_id = data.nutanix_categories_v2.categories.categories.0.ext_id
}
}
categories{
ext_id = data.nutanix_categories_v2.categories.categories.1.ext_id
}
categories{
ext_id = data.nutanix_categories_v2.categories.categories.2.ext_id
}
}
`
Expand Down
82 changes: 82 additions & 0 deletions website/docs/r/associate_category_to_volume_group_v2.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
layout: "nutanix"
page_title: "NUTANIX: nutanix_associate_category_to_volume_group_v2"
sidebar_current: "docs-nutanix-resource-associate-category-to-volume-group-v2"
description: |-
This operation submits a request to Creates a new Volume Disk.
---

# nutanix_volume_group_v2

Provides a resource to Creates a new Volume Disk.

## Example Usage

```hcl
resource "nutanix_volume_group_v2" "example"{
name = "test_volume_group"
description = "Test Volume group with min spec and no Auth"
should_load_balance_vm_attachments = false
sharing_status = "SHARED"
target_name = "volumegroup-test-0"
created_by = "Test"
cluster_reference = "<Cluster uuid>"
iscsi_features {
enabled_authentications = "CHAP"
target_secret = "1234567891011"
}
storage_features {
flash_mode {
is_enabled = true
}
}
usage_type = "USER"
is_hidden = false
lifecycle {
ignore_changes = [
iscsi_features[0].target_secret
]
}
}
# List categories
data "nutanix_categories_v2" "categories"{}
# Associate categories to volume group
resource "nutanix_associate_category_to_volume_group_v2" "example"{
ext_id = nutanix_volume_group_v2.example.id
categories{
ext_id = data.nutanix_categories_v2.categories.categories.0.ext_id
}
categories{
ext_id = data.nutanix_categories_v2.categories.categories.1.ext_id
}
categories{
ext_id = data.nutanix_categories_v2.categories.categories.2.ext_id
}
}
```

## Argument Reference

The following arguments are supported:

* `ext_id `: -(Required) The external identifier of the Volume Group.
* `categories`: -(Required) The category to be associated/disassociated with the Volume Group. This is a mandatory field.


### categories

The categories attribute supports the following:

* `ext_id`: -(Required) The external identifier of the category.
* `name`: -(Optional) Name of entity that's represented by this reference
* `uris`: -(Optional) URI of entities that's represented by this reference.
* `entity_type`: -(Optional) Type of entity that's represented by this reference. Default value is "CATEGORY". Valid values are:
* "CATEGORY".

See detailed information in [Nutanix Associate/Disassociate category to/from a Volume Group V4](https://developers.nutanix.com/api-reference?namespace=volumes&version=v4.0#tag/VolumeGroups/operation/associateCategory).

0 comments on commit b0cf6e6

Please sign in to comment.