exoscale_compute_instance (Resource)

Manage Exoscale Compute Instances.

Corresponding data sources: exoscale_compute_instance, exoscale_compute_instance_list.

After the creation, you can retrieve the password of an instance with Exoscale CLI: exo compute instance reveal-password NAME.

Example Usage

data "exoscale_template" "my_template" {
  zone = "ch-gva-2"
  name = "Linux Ubuntu 22.04 LTS 64-bit"
}

resource "exoscale_compute_instance" "my_instance" {
  zone = "ch-gva-2"
  name = "my-instance"

  template_id = data.exoscale_template.my_template.id
  type        = "standard.medium"
  disk_size   = 10
}

Please refer to the examples directory for complete configuration examples.

Schema

Required

  • name (String) The compute instance name.
  • template_id (String) ❗ The exoscale_template (ID) to use when creating the instance.
  • type (String) The instance type (<family>.<size>, e.g. standard.medium; use the Exoscale CLI - exo compute instance-type list - for the list of available types). WARNING: updating this attribute stops/restarts the instance.
  • zone (String) ❗ The Exoscale Zone name.

Optional

  • anti_affinity_group_ids (Set of String) ❗ A list of exoscale_anti_affinity_group (IDs) to attach to the instance (may only be set at creation time).
  • block_storage_volume_ids (Set of String) A list of exoscale_block_storage_volume (ID) to attach to the instance.
  • deploy_target_id (String) ❗ A deploy target ID.
  • destroy_protected (Boolean) Mark the instance as protected, the Exoscale API will refuse to delete the instance until the protection is removed (boolean; default: false).
  • disk_size (Number) The instance disk size (GiB; at least 10). Can not be decreased after creation. WARNING: updating this attribute stops/restarts the instance.
  • elastic_ip_ids (Set of String) A list of exoscale_elastic_ip (IDs) to attach to the instance.
  • ipv6 (Boolean) Enable IPv6 on the instance (boolean; default: false).
  • labels (Map of String) A map of key/value labels.
  • network_interface (Block Set) Private network interfaces (may be specified multiple times). Structure is documented below. (see below for nested schema)
  • private (Boolean) Whether the instance is private (no public IP addresses; default: false)
  • reverse_dns (String) Domain name for reverse DNS record.
  • security_group_ids (Set of String) A list of exoscale_security_group (IDs) to attach to the instance.
  • ssh_key (String) The exoscale_ssh_key (name) to authorize in the instance (may only be set at creation time).
  • state (String) The instance state (running or stopped; default: running).
  • timeouts (Block, Optional) (see below for nested schema)
  • user_data (String) cloud-init configuration.

Read-Only

  • created_at (String) The instance creation date.
  • id (String) The ID of this resource.
  • ipv6_address (String) The instance (main network interface) IPv6 address (if enabled).
  • mac_address (String) MAC address
  • private_network_ids (Set of String, Deprecated) A list of private networks (IDs) attached to the instance. Please use the network_interface.*.network_id argument instead.
  • public_ip_address (String) The instance (main network interface) IPv4 address.

Nested Schema for network_interface

Required:

Optional:

  • ip_address (String) The IPv4 address to request as static DHCP lease if the network interface is attached to a managed private network.

Read-Only:

  • mac_address (String) MAC address

Nested Schema for timeouts

Optional:

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

-> The symbol ❗ in an attribute indicates that modifying it, will force the creation of a new resource.

Import

# An existing compute instance may be imported by `<ID>@<zone>`:

terraform import \
  exoscale_compute_instance.my_instance \
  f81d4fae-7dec-11d0-a765-00a0c91e6bf6@ch-gva-2