Skip to main content

dtcloud_vm (Data Source)

Looks up a single virtual machine by id.

Lookup is by id because machine names are not unique: the platform holds several machines with the same name, and its multi-create path generates name-1, name-2 and so on, so a name could not resolve to one instance.

Example Usage​

data "dtcloud_vm" "web" {
id = var.vm_id
}

Schema​

Required​

  • id (String) ID of the virtual machine to look up.

Read-Only​

  • created_at (String) When the VM was created, in RFC 3339 format.
  • flavor_name (String) Human-readable name of the VM's flavor.
  • image (String) Name of the image the VM was built from.
  • image_os_type (String) OS family of the image, e.g. linux or windows.
  • last_modified (String) When the VM was last modified, in RFC 3339 format.
  • name (String) Name of the virtual machine.
  • network_interface (List of Object) Network interfaces currently attached to the VM. (see below for nested schema)
  • primary_ip (String) Convenience shortcut: the primary IP of the first public interface, falling back to the first interface with an address.
  • ram (String) Memory as reported by the API, e.g. "512 MB".
  • ssh_key (String) Name of the SSH key injected into the VM.
  • status (String) Current power/provisioning state, e.g. ACTIVE, SHUTOFF, ERROR.
  • task_state (String) In-flight platform task, empty when the VM is settled.
  • vcpus (Number) Number of virtual CPUs.
  • volume (List of Object) Volumes currently attached to the VM, including the boot disk. (see below for nested schema)

Nested Schema for network_interface​

Read-Only:

  • is_public (Boolean)
  • mac_address (String)
  • network_id (String)
  • network_name (String)
  • port_id (String)
  • primary_ip (String)
  • secondary_ips (List of String)
  • security_groups (List of Object) (see below for nested schema)
  • spoofing_protection (Boolean)

Nested Schema for network_interface.security_groups​

Read-Only:

  • id (String)
  • name (String)

Nested Schema for volume​

Read-Only:

  • delete_on_termination (Boolean)
  • id (String)
  • name (String)
  • size (Number)
  • storage_policy (String)

Behaviour worth knowing​

  • Interfaces and volumes come from their own endpoints, as on the resource. If one of them cannot be read, the lookup still succeeds with a warning and that list stays empty.
  • A machine that does not exist is an error, not an empty result.