powerscale_snapshot (Resource)

This resource is used to manage the Snapshot entity of PowerScale Array. We can Create, Update and Delete the Snapshot using this resource. We can also import an existing Snapshot from PowerScale array. PowerScale Snapshots is a logical pointer to data that is stored on a cluster at a specific point in time.

Example Usage

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

# Available actions: Create, Update (name, expire), Delete and Import
# After `terraform apply` of this example file it will create a new snapshot for the path name set in `path` attribute on the PowerScale

# Note: This resource can be used to create a manual snapshot at a single point in time. Howerver, if the user wants to take snapshots on a regular cadence, they should use the snapshot_schedules resource. 

# PowerScale Snapshots is a logical pointer to data that is stored on a cluster at a specific point in time.
resource "powerscale_snapshot" "snap" {

  # Required path to the filesystem to which the snapshot will be taken of
  # This cannot be changed after create
  path = "/ifs/tfacc_file_system_test"

  # Optional name of the new snapshot. If unset uses the current date and time for the name attribute (Can be modified)
  name = "tfacc_snapshot_1"

  # Optional set_expires The amount of time from creation before the snapshot will expire and be eligible for automatic deletion.  (Can be modified)
  # Options: Never(default if unset), 1 Day, 1 Week, 1 Month.
  set_expires = "1 Day"
}

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

Schema

Required

  • path (String) The /ifs path snapshotted.

Optional

  • name (String) The user or system supplied snapshot name. This will be null for snapshots pending delete. Only alphanumeric characters, underscores ( _ ), and hyphens (-) are allowed. (Update Supported)
  • set_expires (String) The amount of time from creation before the snapshot will expire and be eligible for automatic deletion. Resets each time this value is updated (Update Supported)

Read-Only

  • alias (String) The name of the alias, none for real snapshots.
  • created (Number) The Unix Epoch time the snapshot was created.
  • expires (Number) The Unix Epoch time the snapshot will expire and be eligible for automatic deletion.
  • has_locks (Boolean) True if the snapshot has one or more locks present see, see the locks subresource of a snapshot for a list of lock.
  • id (String) The system ID given to the snapshot. This is useful for tracking the status of delete pending snapshots.
  • pct_filesystem (Number) Percentage of /ifs used for storing this snapshot.
  • pct_reserve (Number) Percentage of configured snapshot reserved used for storing this snapshot.
  • schedule (String) The name of the schedule used to create this snapshot, if applicable.
  • shadow_bytes (Number) The amount of shadow bytes referred to by this snapshot.
  • size (Number) The amount of storage in bytes used to store this snapshot.
  • state (String) Snapshot state.
  • target_id (Number) The ID of the snapshot pointed to if this is an alias. 18446744073709551615 (max uint64) is returned for an alias to the live filesystem.
  • target_name (String) The name of the snapshot pointed to if this is an alias.

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.

# The command is
# terraform import powerscale_snapshot.test <id>
# Example:
terraform import powerscale_snapshot.test id
# after running this command, populate the name field and other required parameters in the config file to start managing this resource.
# Note: running "terraform show" after importing shows the current config/state of the resource. You can copy/paste that config to make it easier to manage the resource.