Skip to main content

dtcloud_image (Data Source)

Looks up one image, by id or by name.

Use it to reference an image Terraform did not upload: one from the platform's own catalogue, or one somebody built by hand. Declaring such an image as a resource would hand Terraform ownership of it, and a later destroy would delete it.

Example Usage​

# By name. The lookup refuses an ambiguous answer rather than picking the first
# match, because image names are not unique on the platform.
data "dtcloud_image" "ubuntu" {
name = "Ubuntu 22.04"
}

data "dtcloud_image" "by_id" {
id = var.image_id
}

Schema​

Optional​

  • id (String) ID of the image to look up. Give this or name.
  • name (String) Name of the image to look up. Give this or id. It is an error for more than one image to carry the name.

Read-Only​

  • min_disk (Number) Smallest volume, in GB, a machine built from this image needs. 0 when the platform reports none.
  • os_distro (String) Distribution the image carries.
  • os_type (String) linux or windows, when the platform reports it. Frequently empty here: the details endpoint passes the value straight through, while the list endpoint behind dtcloud_images guesses it from os_distro when it is missing.
  • size (String) Size of the captured data, as the platform formats it — 1.2 GB or 250 MB. There is no endpoint that reports it as a number. An image with no data yet reads as 0 MB.
  • status (String) Status reported by the platform. active is the only status a machine can be built from; queued and saving mean the data is not there yet, and killed means the capture failed.
  • type (String) How the platform categorises the image: ISO or Template (VM). This is not disk_format — it is derived from it, and the two are not interchangeable.
  • uefi (Boolean) Whether the image boots with UEFI firmware rather than BIOS.
  • visibility (String) Who can see the image: public, private, shared or community.

Behaviour worth knowing​

  • A name must match exactly one image. Image names are not unique on the platform. A lookup that matches several fails and lists the matching ids, rather than building machines from an image nobody chose.
  • Both lookups end on the details endpoint, so the same fields come back however the image was found. That endpoint often reports an empty os_type; dtcloud_images fills it in from os_distro.
  • An image that does not exist is an error, not an empty result.