powerflex_snapshot (Resource)

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

Warning: Snapshot 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 volume_name and volume_id is required.

Example Usage

# Commands to run this tf file : terraform init && terraform plan && terraform apply
# Create, Update, Delete is supported for this resource
# To import , check snapshot_resource_import.tf for more info
# To create / update, either volume_id or volume_name must be provided
# name is the required parameter to create or update
# other  atrributes like : access_mode, size, capacity_unit, lock_auto_snapshot, desired_retention, retention_unit, 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_snapshot" "snapshots-create" {
  name      = "snapshots-create"
  volume_id = "4577c84000000120"
}

resource "powerflex_snapshot" "snapshots-create-01" {
  name          = "snapshots-create-epsilon"
  volume_id     = "4577c84000000120"
  access_mode   = "ReadWrite"
  size          = 16
  capacity_unit = "GB"
  remove_mode   = "INCLUDING_DESCENDANTS"
  sdc_list = [
    {
      sdc_id           = "e3ce1fb500000000"
      limit_iops       = 200
      limit_bw_in_mbps = 40
      access_mode      = "ReadWrite"
    },
    {
      sdc_id           = "e3ce1fb500000000"
      limit_iops       = 190
      limit_bw_in_mbps = 70
      access_mode      = "NoAccess"
    },
    {
      sdc_id           = "e3ce46c600000003"
      limit_iops       = 82
      limit_bw_in_mbps = 17
      access_mode      = "ReadOnly"
    },
  ]
}


# General guidlines for furnishing this resource block 
# resource "powerflex_snapshot" "snapshots-create-1" {
# 	name = "<snapshot name>"
# 	volume_name = "<volume name>"
# 	access_mode = "<access mode options are ReadOnly/ReadWrite, default value ReadOnly>"
# 	size = "<size[int] associated with capacity unit>"
# 	capacity_unit =  "<capacity unit options are gb/tb, default value gb>"
# 	lock_auto_snapshot = "<lock auto snapshot, snapshot which are created by snapshot policy can be locked.>"
# 	desired_retention = "<desired retention[int] associated with retention unit>"
# 	retention_unit = "<retention unit options are hours/days, default value hours>"
# 	remove_mode = "<remove mode options are ONLY_ME/INCLUDING_DESCENDANTS, default value ONLY_ME>"
# 	sdc_list = [
# 	   {
# 		sdc_id = "<sdc id either of sdc_id/sdc_name should be present to map snapshot to sdc>"
# 		limit_iops = "<limit iops setting on mapped sdc>"
# 		limit_bw_in_mbps = "<limit bw in mbps setting on mapped sdc>"
# 		access_mode = "<access mode options are ReadOnly/ReadWrite, default value ReadOnly>"
# 	   },
# 	   	   {
# 		sdc_name = "<sdc name either of sdc_id/sdc_name should be present to map snapshot to sdc>"
# 		limit_iops = "<limit iops setting on mapped sdc>"
# 		limit_bw_in_mbps = "<limit bw in mbps setting on mapped sdc>"
# 		access_mode = "<access mode options are ReadOnly/ReadWrite, default value ReadOnly>"
# 	   }
# 	]
# }

Schema

Required

  • name (String) The name of the snapshot.

Optional

  • access_mode (String) The Access mode of snapshot. 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.
  • desired_retention (Number) The minimum amount of time that the snapshot should be retained on the array starting at the time of apply. The unit is defined by retention_unit. Cannot be decreased.
  • lock_auto_snapshot (Boolean) lock auto snapshot
  • remove_mode (String) Remove mode of the snapshot. Valid values are ONLY_ME and INCLUDING_DESCENDANTS. Default value is ONLY_ME.
  • retention_unit (String) Retention unit of the snapshot. Valid values are hours and days. Default value is hours.
  • 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)
  • size (Number) Size of the snapshot. The unit of size is defined by capacity_unit. The storage capacity of a snapshot must be a multiple of 8GB and cannot be decreased.
  • volume_id (String) The ID of the volume from which snapshot is to be created. Conflicts with volume_name. Cannot be updated.
  • volume_name (String) The volume name for which snapshot is created. Conflicts with volume_id. Cannot be updated.

Read-Only

  • id (String) The ID of the snapshot.
  • retention_in_min (String) retention of snapshot in min
  • 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 snapshot :
# Step 1 - To import a snapshot , we need the id of that snapshot 
# Step 2 - create a tf file with empty resource block . Refer the example below.
# Example :
# resource "powerflex_snapshot" "resource_block_name" {
# }
# Step 3 - execute the command: terraform import "powerflex_snapshot.resource_block_name" "id_of_the_snapshot" (resource_block_name must be taken from step 2)
# Step 4 - After successful execution of the command , check the state file