powerflex_snapshot_policy (Resource)
This resource is used to manage the Snapshot Policy entity of the PowerFlex Array. We can Create, Update and Delete the snapshot policy using this resource. We can also import an existing snapshot policy from the 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
}
After the execution of above resource block, snapshot_policy would have been created on the PowerFlex array. For more information, please check the terraform state file.
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 Policynum_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 isfalse
.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 isDetach
.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 isfalse
. Cannot be updated.snapshot_access_mode
(String) The Access mode of auto snapshot. Valid values are ‘ReadOnly’ and ‘ReadWrite’. Default value isReadOnly
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>"
- This will import the snapshot_policy instance with specified ID into your Terraform state.
- After successful import, you can run terraform state list to ensure the resource has been imported successfully.
- Now, you can fill in the resource block with the appropriate arguments and settings that match the imported resource’s real-world configuration.
- Execute terraform plan to see if your configuration and the imported resource are in sync. Make adjustments if needed.
- Finally, execute terraform apply to bring the resource fully under Terraform’s management.
- Now, the resource which was not part of terraform became part of Terraform managed infrastructure.