powerflex_volume (Resource)

This resource can be used to manage volumes on a PowerFlex array.

Warning: Volume creation or update is not atomic. In case of partially completed operations, terraform can mark the resource as tainted. One can manually remove the taint and try applying the configuration (after making necessary adjustments). If the taint is not removed, terraform will destroy and recreate the resource.

Note: Exactly one of protection_domain_name and protection_domain_id and exactly one of storage_pool_name and storage_pool_id are required.

Example Usage

# Command to run this tf file : terraform init && terraform plan && terraform apply
# Create, Update, Delete is supported for this resource
# To import , check volume_resource_import.tf for more info
# To create / update, either storage_pool_id or storage_pool_name must be provided
# Also , to create / update, either protection_domain_id or protection_domain_name must be provided
# name, size is the required parameter to create or update
# other  atrributes like : capacity_unit, volume_type, use_rm_cache, compression_method, access_mode, remove_mode, sdc_list are optional 
# To check which attributes of the snapshot can be updated, please refer Product Guide in the documentation


resource "powerflex_volume" "avengers-volume-create" {
  name                   = "avengers-volume-create"
  protection_domain_name = "domain1"
  storage_pool_name      = "pool1" #pool1 have medium granularity
  size                   = 8
  use_rm_cache           = true
  volume_type            = "ThickProvisioned"
  access_mode            = "ReadWrite"
  sdc_list = [
    {
      sdc_name         = "sdc_01"
      limit_iops       = 119
      limit_bw_in_mbps = 19
      access_mode      = "ReadOnly"
    },
  ]
}


# General guidlines for furnishing this resource block  
# resource "powerflex_volume" "avengers-volume-create"{
# 	name = "<volume-name>"
# 	protection_domain_name = "<protection-domain-name>"
# 	storage_pool_name = "<storage-pool-name>"
# 	size = "<size in int>"
# 	capacity_unit = "<GB/TB capacity unit>"
# 	use_rm_cache = "true/false for use rm cache" 
# 	volume_type = "<ThickProvisioned/ThinProvisioned volume type>" 
# 	access_mode = "<ReadWrite/ReadOnly volume access mode>"
# 	compression_method = "<None/Normal compression method>"
# 	sdc_list = [
# 	  		{
# 			   sdc_name = "<sdc name>"
# 			   limit_iops = "<iops limit in int>"
# 			   limit_bw_in_mbps = "<bandwidth limit in mbps>"
# 			   access_mode = "<ReadWrite/ReadOnly/Noaccess sdc access mode>"
# 		   },
# 	]
# }

Schema

Required

  • name (String) The name of the volume.
  • size (Number) Size of the volume. The unit of size is defined by capacity_unit. The storage capacity of a volume must be a multiple of 8GB and cannot be decreased.

Optional

  • access_mode (String) The Access mode of the volume. Valid values are ReadOnly and ReadWrite. Default value is ReadOnly.
  • capacity_unit (String) Unit of capacity of the volume. Must be one of GB and TB. Default value is GB.
  • compression_method (String) Compression Method of the volume. Valid values are None and Normal.
  • protection_domain_id (String) ID of the Protection Domain under which the volume will be created. Conflicts with protection_domain_name. Cannot be updated.
  • protection_domain_name (String) Name of the Protection Domain under which the volume will be created. Conflicts with protection_domain_id. Cannot be updated.
  • remove_mode (String) Remove mode of the volume. Valid values are ONLY_ME and INCLUDING_DESCENDANTS. Default value is ONLY_ME.
  • sdc_list (Attributes Set, Deprecated) List of SDCs to be mapped to the volume. Exactly one of sdc_id or sdc_name must be specified. (see below for nested schema)
  • storage_pool_id (String) ID of the Storage Pool under which the volume will be created. Conflicts with storage_pool_name. Cannot be updated.
  • storage_pool_name (String) Name of the Storage Pool under which the volume will be created. Conflicts with storage_pool_id. Cannot be updated.
  • use_rm_cache (Boolean) use rm cache
  • volume_type (String) Volume type. Valid values are ThickProvisioned and ThinProvisioned. Default value is ThinProvisioned.

Read-Only

  • id (String) The ID of the volume.
  • size_in_kb (Number) Size in KB

Nested Schema for sdc_list

Optional:

  • access_mode (String) The Access Mode of the SDC. Valid values are ReadOnly, ReadWrite and NoAccess. Default value is ReadOnly
  • limit_bw_in_mbps (Number) Bandwidth limit in MBPS of the SDC. 0 represents unlimited IOPS. Default value is 0.
  • limit_iops (Number) IOPS limit of the SDC. Valid values are 0 or integers greater than 10. 0 represents unlimited IOPS. Default value is 0.
  • sdc_id (String) The ID of the SDC. Conflicts with sdc_name. Cannot be updated.
  • sdc_name (String) The Name of the SDC. Conflicts with sdc_id. Cannot be updated.

Import

Import is supported using the following syntax:

# Below are the steps to import volume :
# Step 1 - To import a volume , we need the id of that volume 
# Step 2 - To check the id of the volume we can make use of volume datasource . Please refer volume_datasource.tf for more info.
# Step 3 - create a tf file with empty resource block . Refer the example below.
# Example :
# resource "powerflex_volume" "resource_block_name" {
# }
# Step 4 - execute the command: terraform import "powerflex_volume.resource_block_name" "id_of_the_volume" (resource_block_name must be taken from step 3 and id must be taken from step 2)
# Step 5 - After successful execution of the command , check the state file
# For volume resource, the user will not find the value for protection_domain_name, size attributes in the state file.
# For protection_domain_name and size, refer  GUI