powerflex_volume (Resource)

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

Caution: Volume creation or update is not atomic. In case of partially completed create 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

/*
Copyright (c) 2023 Dell Inc., or its subsidiaries. All Rights Reserved.

Licensed under the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://mozilla.org/MPL/2.0/


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

# 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 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"
}


# 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>"
# }

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.
  • 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

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