powerflex_snapshot (Resource)

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

Caution: Snapshot 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 volume_name and volume_id is required. In case of partial create/update operation, retention will not be set.

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.
*/

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


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

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

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