powerstore_volume_snapshot (Resource)

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

Note: volume_id/volume_name is the required attribute to create volume snapshot. Note: if name is present in the config it cannot be blank(""). if absent, default value is allocated to it. Note: During create operation, if expiration_timestamp is not specified or set to blank(""), snapshot will be created with infinite retention. Note: During modify operation, to set infinite retention, expiration_timestamp can be set to blank(""). Note: Volume DataSource can be used to fetch volume ID/Name for volume snapshot creation. Note: Exactly one of volume_id and volume_name should be provided.

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

# Commands to run this tf file : terraform init && terraform plan && terraform apply
# Create, Update, Delete is supported for this resource
# To import , check volume_snapshot_import.tf for more info
# volume_id/volume_name is the required attribute to create volume snapshot.
# name, expiration_timestamp, performance_policy_id and description are the optional attributes
# if name is present in the config it cannot be blank("").
# During create operation, if expiration_timestamp is not specified or set to blank(""), snapshot will be created with infinite retention.
# During modify operation, to set infinite retention, expiration_timestamp can be set to blank("").
# Either volume_id or volume_name should be present.
# Volume DataSource can be used to fetch volume ID/Name
# To check which attributes of the volume snapshot resource can be updated, please refer Product Guide in the documentation

resource "powerstore_volume_snapshot" "test" {
  name                  = "test_snap"
  description           = "powerstore volume snapshot"
  volume_id             = "01d88dea-7d71-4a1b-abd6-be07f94aecd9"
  performance_policy_id = "default_medium"
  expiration_timestamp  = "2023-05-06T09:01:47Z"
}

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

Schema

Optional

  • creator_type (String) Creator Type of the volume snapshot.
  • description (String) Description of the volume snapshot.
  • expiration_timestamp (String) Expiration Timestamp of the volume snapshot.Only UTC (+Z) format is allowed.
  • name (String) Name of the volume snapshot.The default name of the volume snapshot is the date and time when the snapshot is taken.
  • performance_policy_id (String) Performance Policy id of the volume snapshot. Valid values are default_medium, default_low, default_high.
  • volume_id (String) ID of the volume to take snapshot. Conflicts with volume_name. Cannot be updated.
  • volume_name (String) Name of the volume to take snapshot. Conflicts with volume_id. Cannot be updated.

Read-Only

  • id (String) The unique identifier of the volume snapshot.

Import

Import is supported using the following syntax:

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


# Below are the steps to import snapshot :
# Step 1 - To import a volume snapshot , we need the id of that volume snapshot
# Step 2 - To check the id of the volume snapshot we can make Get request to volume snapshot endpoint. eg. https://10.0.0.1/api/rest/volume --header 'type: Snapshot' which will return list of all volume snapshots ids.
# Step 3 - Add empty resource block in tf file.
# eg.
# resource "powerstore_volume_snapshot" "resource_block_name" {
  # (resource arguments)
# }
# Step 4 - Execute the command: terraform import "powerstore_volume_snapshot.resource_block_name" "id_of_the_snapshot" (resource_block_name must be taken from step 3 and id must be taken from step 2)
# Step 5 - After successful execution of the command , check the state file