powerflex_snapshot_policy (Resource)

This resource is used to manage the Snapshot Policy entity of PowerFlex Array. We can Create, Update and Delete the snapshot policy using this resource. We can also import an existing snapshot policy from PowerFlex array.

Example Usage

/*
Copyright (c) 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, num_of_retained_snapshots_per_level, auto_snapshot_creation_cadence_in_min is the required parameter to create or update 


resource "powerflex_snapshot_policy" "sp" {
  name                                  = "snap-create"
  num_of_retained_snapshots_per_level   = [2, 6, 7]
  auto_snapshot_creation_cadence_in_min = 6
  volume_ids                            = ["edd2fb3100000007", "edd322270000000a"] # assigning or unassigning volumes to snapshot policy
  snapshot_access_mode                  = "ReadWrite"                              # Cannot be updated after creation. It only supports two values : ReadOnly / ReadWrite
  secure_snapshots                      = false                                    # Cannot be updated after creation
  #remove_mode = "Remove" #remove_mode is applicable while unassingning the volumes from the snapshot policy. It only supports two values : Remove / Detach
}

Schema

Required

  • auto_snapshot_creation_cadence_in_min (Number) The interval in minutes between two snapshots in the policy.
  • name (String) Name of the Snapshot Policy
  • num_of_retained_snapshots_per_level (List of Number) List which represents the number of snapshots per retention level.

Optional

  • paused (Boolean) Indicates that the snapshot policy should paused or not. Default value is false.
  • remove_mode (String) When removing the source volume from the policy, user should choose how to handle the snapshots created by the policy. Valid values are ‘Remove’ and ‘Detach’. Default value is Detach.
  • secure_snapshots (Boolean) The auto snapshots will be created as secure. They cannot be edited or removed prior to their policy expiration time. Default value is false. Cannot be updated.
  • snapshot_access_mode (String) The Access mode of auto snapshot. Valid values are ‘ReadOnly’ and ‘ReadWrite’. Default value is ReadOnly Cannot be updated.
  • volume_ids (Set of String) List which represents the volume ids which is to be assigned to the snapshot policy.

Read-Only

  • id (String) ID of the Snapshot Policy.

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 snapshot policy by it's id
terraform import powerflex_snapshot_policy.snapshot_policy_import_by_id "<id>"