powerflex_volume (Resource)

This resource is used to manage the Volume entity of the PowerFlex Array. We can Create, Update and Delete the volume using this resource. We can also import an existing volume from the 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: Either protection_domain_name or protection_domain_id is required. But not both. Note: Either storage_pool_name or storage_pool_id is required. But not both.

Example Usage

/*
Copyright (c) 2023-2024 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 import.sh for more info
# 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 volume can be updated, please refer Product Guide in the documentation

# Example for creating volume. After successful execution, volume will be created with 8 GB size.
resource "powerflex_volume" "avengers-volume-create" {
  name = "avengers-volume-create"

  # To create / update, either protection_domain_id or protection_domain_name must be provided
  protection_domain_name = "domain1"

  # To create / update, either storage_pool_id or storage_pool_name must be provided
  storage_pool_name = "pool1"

  # The unit of size of the volume is defined by capacity_unit whose default value is "GB".
  size          = 8
  capacity_unit = "GB" # GB/TB

  use_rm_cache = true
  volume_type  = "ThickProvisioned"      # ThickProvisioned/ThinProvisioned volume type
  access_mode  = "ReadWrite"             # ReadWrite/ReadOnly volume access mode
  remove_mode  = "INCLUDING_DESCENDANTS" # INCLUDING_DESCENDANTS/ONLY_ME remove mode
}

After the execution of above resource block, volume would have been created on the PowerFlex array. For more information, please check the terraform state file.

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:

# /*
# Copyright (c) 2023-2024 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.
# */

# import volume by it's id
terraform import powerflex_volume.volume_import_by_id "<id>"
  1. This will import the volume instance with specified ID into your Terraform state.
  2. After successful import, you can run terraform state list to ensure the resource has been imported successfully.
  3. Now, you can fill in the resource block with the appropriate arguments and settings that match the imported resource’s real-world configuration.
  4. Execute terraform plan to see if your configuration and the imported resource are in sync. Make adjustments if needed.
  5. Finally, execute terraform apply to bring the resource fully under Terraform’s management.
  6. Now, the resource which was not part of terraform became part of Terraform managed infrastructure.