Skip to content
Odinex Cloud
Terraform providerReferenceResources

odinex_server

Manages an Odinex Cloud server.

Manages an Odinex Cloud server.

Changing server_type powers the server off, changes the type and powers it on again. Changing image rebuilds the server (all data on its disk is lost).

Example Usage

resource "odinex_server" "web" {
  name         = "web-1"
  server_type  = "t1"
  image        = "ubuntu-24.04"
  location     = "fra1"
  ssh_keys     = [odinex_ssh_key.admin.id]
  firewall_ids = [odinex_firewall.ssh.id]
  backups      = true
  labels       = { role = "web" }

  network {
    network_id = odinex_network.private.id
    ip         = "10.0.1.5"
  }

  public_net {
    ipv4_enabled = true
    ipv6_enabled = true
  }
}

Schema

Required

  • image (String) Name or ID of the image (e.g. ubuntu-24.04, or a snapshot ID). Changing it rebuilds the server.
  • location (String) Location (region) name, e.g. fra1.
  • name (String) Name of the server (hostname-safe: letters, digits, dots and dashes).
  • server_type (String) Name or ID of the server type (e.g. t1). Can be changed in place: the server is powered off, resized and powered on.

Optional

  • backups (Boolean) Enable daily backups (+20 % of the server price). Disabling deletes all existing backups.
  • delete_protection (Boolean) Prevent the resource from being deleted. Defaults to false.
  • firewall_ids (Set of Number) IDs of firewalls applied directly to the server (at most 5 at creation; they are active before the first boot). Changes apply or remove the firewalls in place. Only tracked while set; firewalls applied through label selectors are not listed. Use either this or odinex_firewall.apply_to / odinex_firewall_attachment for a given server, not both.
  • keep_disk (Boolean) When changing server_type, keep the current disk size so the server can be downgraded later. Defaults to false (the disk is upgraded).
  • labels (Map of String) User-defined labels (key/value pairs). Up to 64 pairs; keys and values up to 63 characters.
  • network (Block Set) Private networks to attach the server to. Networks are attached and detached in place. Do not combine with odinex_server_network for the same server.
  • placement_group_id (Number) ID of the placement group. The API only sets it at creation, so changing it recreates the server.
  • public_net (Block, Optional) Public network configuration. Changing it recreates the server.
  • shutdown_before_deletion (Boolean) Gracefully shut the server down before deleting it. Defaults to false.
  • ssh_keys (List of String) SSH key names or IDs to install. Changing them recreates the server. Without SSH keys a root password is generated (not stored).
  • timeouts (Block, Optional)
  • user_data (String) Cloud-init user data. Changing it recreates the server.

Read-Only

  • backup_window (String) UTC hours of the daily backup, e.g. 22-02; empty when backups are off.
  • id (String) Unique ID of the resource.
  • ipv4_address (String) Public IPv4 address (empty when IPv4 is disabled).
  • ipv6_address (String) Public IPv6 address (empty when IPv6 is disabled).
  • primary_disk_size (Number) Size of the primary disk in GB.
  • primary_ipv4_id (Number) ID of the primary IP holding the public IPv4 address (use it with odinex_rdns.primary_ip_id).
  • primary_ipv6_id (Number) ID of the primary IP holding the public IPv6 address.
  • status (String) Status of the server (running, off, …).

Nested Schema for network

Required:

  • network_id (Number) ID of the network.

Optional:

  • ip (String) Fixed IP inside the network; assigned automatically when omitted.

Nested Schema for public_net

Optional:

  • ipv4_enabled (Boolean) Assign a public IPv4 address. Defaults to true.
  • ipv6_enabled (Boolean) Assign a public IPv6 address. Defaults to true.

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.
  • 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).

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# Import by ID or by name. network/public_net blocks, ssh_keys and user_data are not imported.
terraform import odinex_server.web 42
terraform import odinex_server.web web-1

On this page