Resource

dcloud_snapshot_policy

Takes machine images of instances on a schedule and keeps the newest retain_count of each. Deleting the policy keeps the images it took.

Example Usage

# A nightly image of every instance tagged backup=nightly, the last 7 kept.
resource "dcloud_snapshot_policy" "nightly" {
  name           = "nightly"
  interval_hours = 24
  start_time     = "02:30"
  retain_count   = 7
  target_tags    = { backup = "nightly" }
}

Schema

Required

  • interval_hours (Number) Hours between runs: 1, 2, 3, 4, 6, 8, 12, 24 or 168 (weekly, on Mondays)
  • name (String) A display name. Up to 64 characters.
  • retain_count (Number) Images kept per instance; older ones this policy took are deregistered. From 1 to 100.
  • start_time (String) HH:MM UTC; runs fall on this time plus whole intervals

Optional

  • description (String) Free text; null clears it. Up to 255 characters.
  • enabled (Boolean) A paused policy takes nothing and keeps its images
  • region_id (String) The region the policy belongs to, e.g. de1. Up to 32 characters. Defaults to the provider's region. Changing it replaces the resource.
  • target_instance_ids (Set of String) Instances to snapshot (i-…)
  • target_tags (Map of String) Also snapshot every instance that carries all of these tags

Read-Only

  • id (String) The resource's id.
  • next_run_at (String) When it runs next.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dcloud_snapshot_policy.nightly <policy-id>

Generated from the provider's schema.