Skip to main content

dtcloud_snapshot (Resource)

Manages a point-in-time copy of a volume.

Size and storage policy come from the source volume at the moment the copy is taken, so only name and description change in place. Restoring is not done here: a restore produces a volume, so it belongs to dtcloud_volume through source_snapshot_id.

Example Usage​

resource "dtcloud_snapshot" "nightly" {
name = "app-data-2026-01-31"
volume_id = dtcloud_volume.data.id
description = "Before the schema migration"
}

# Restoring is not done here: a restore produces a volume, so it belongs to the
# volume resource.
resource "dtcloud_volume" "restored" {
name = "app-data-restored"
size = 100
storage_policy = "standard"
source_snapshot_id = dtcloud_snapshot.nightly.id
}

Schema​

Required​

  • name (String) Name of the snapshot. Can be changed in place.
  • volume_id (String) ID of the volume to snapshot. The volume may be attached to a running machine. Changing it takes a new snapshot and destroys this one. Changing this forces a new resource to be created.

Optional​

  • description (String) Free-text description. Removing it from the configuration clears it on the platform — the API expresses that as a JSON null, since it rejects an empty string outright.
  • timeouts (Block, Optional) (see below for nested schema)

Read-Only​

  • created_at (String) When the snapshot was taken, as the platform reports it. The API sends no timezone, and the value is passed through unchanged.
  • id (String) The ID of this resource.
  • progress (String) How far the copy has got, as a percentage string such as 100%. The only visible sign that a large snapshot is still being written.
  • project_id (String) ID of the project the snapshot belongs to.
  • size (Number) Size in GB, inherited from the source volume. A snapshot cannot be resized; it is as large as the volume was when it was taken.
  • status (String) Status reported by the platform. available is the only resting state.
  • storage_policy (String) Name of the storage policy backing the snapshot, resolved from volume_type_id. Empty if the storage-policies endpoint could not be read.
  • updated_at (String) When the snapshot's metadata last changed. Empty until it is first renamed or re-described.
  • volume_type_id (String) ID of the volume type backing the snapshot, as the snapshots endpoint reports it. storage_policy is the same thing by name.

Nested Schema for timeouts​

Optional:

  • create (String)
  • delete (String)
  • update (String)

Behaviour worth knowing​

  • The source volume may be attached and running. The copy is of the block device as it is at that instant, so it is not a consistent filesystem. If the data matters, quiesce the application or take the snapshot with the machine stopped.
  • description round-trips, unlike a volume's. It is read back, so it drifts, survives an import, and removing it from the configuration clears it on the platform. Create accepts no description, so one is applied by a second call.
  • storage_policy is resolved by the provider. The snapshots endpoint reports only volume_type_id, so the provider looks the name up once per run and shares the answer between every snapshot. The lookup is best-effort: if it fails, storage_policy stays empty for the rest of the run, while volume_type_id is always set.
  • Deleting a volume deletes its snapshots. Destroying the source dtcloud_volume removes every snapshot of it, managed by Terraform or not, and Terraform does not warn about it. With both in one configuration, the reference in volume_id makes Terraform destroy the snapshot first.
  • Deleting a snapshot can be refused while it is still being created, or while a volume restored from it still depends on it. The platform's message is passed through; destroy the dependent volume first.

Timeouts​

create defaults to 30 minutes, update to 15 minutes and delete to 20 minutes. Creating copies the whole volume, so the default is generous; raise it for large volumes. Override them with a timeouts block:

resource "dtcloud_snapshot" "nightly" {
# ...

timeouts {
create = "1h"
}
}

Import​

terraform import dtcloud_snapshot.nightly 9e7d3a02-5c81-4f6b-b294-7a1e6c4d8b55

Everything is read back, description included, so a plan straight after an import is empty when the configuration matches the snapshot.