Skip to content

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

  • 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.
  • 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).
  • elastic_ip_ids (Set of String) A list of exoscale_elastic_ip (IDs) to attach to the instance.
  • enable_secure_boot (Boolean) ❗ Enable secure boot on the instance (boolean; default: false). Can not be changed after the creation.
  • enable_tpm (Boolean) Enable TPM on the instance (boolean; default: false). Can not be disabled after the creation. WARNING: enabling this attribute stops/restarts the instance.
  • ipv6 (Boolean) Enable IPv6 on the instance (boolean; default: false). Can not be disabled after being enabled.
  • 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, Deprecated) ❗ The exoscale_ssh_key (name) to authorize in the instance (may only be set at creation time).
  • ssh_keys (Set of String) ❗ The list of exoscale_ssh_key (name) to authorize in the instance (may only be set at creation time).
  • state (String) The instance state (running or stopped). If omitted, instance will start and reach running state.
  • timeouts (Block, Optional) (see below for nested schema)
  • user_data (String) cloud-init configuration.
  • vpc (Block List) The exoscale_vpc to attach the instance to (at most one block). Removing the block detaches the instance from every subnet. Structure is documented below. (see below for nested schema)

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) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • read (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as “30s” or “2h45m”. Valid time units are “s” (seconds), “m” (minutes), “h” (hours).

Nested Schema for vpc

Required:

  • id (String) The exoscale_vpc (ID) the subnets belong to. An instance may only be attached to one VPC, thus changing it detaches the instance from every subnet of the previous VPC.
  • interfaces (Attributes List) The VPC subnets to attach the instance to. The order is strict: inserting, removing or reordering an element detaches every interface from that position on, then attaches them again in the configured order. Attachments made outside of Terraform are planned for removal, except those with a public IPv4 address: these are left alone unless listed here, which makes Terraform manage them (an attachment listed at its current position and IPv4 address is adopted as is). Positions only count the attachments managed by Terraform: unmanaged ones are skipped, so a position may differ from the NIC name on the instance. Attachment changes are not atomic: if an attachment fails, the interfaces detached before it stay detached until the next apply. (see below for nested schema)

Nested Schema for vpc.interfaces

Required:

Optional:

  • ipv4_address (String) The IPv4 address to allocate to the instance in the subnet, or auto to let the platform pick one (default: auto).

Read-Only:

  • ipv4_address_allocated (String) The IPv4 address allocated to the instance in the subnet.

-> 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
Last updated on