Terraform provider reference / resources / server

fiberax_server (Resource)

A server in the Fiberax project.

Size is set in TWO different ways, and which one applies is decided by the server type:

Which types you can use and which mode each one has comes from GET /v1/server-types: the list is per project, so the provider does not name types or locations here.

Example Usage

# A server type sized by sliders: you choose the size.
resource "fiberax_server" "web" {
  name           = "web-01"
  server_type_id = 4
  image          = "fcf9f69c8630904c1d6d73a821f4e674"

  cores     = 2
  memory_mb = 2048 # whole gigabytes only
  disk_gb   = 20

  # At least one network is required: without a network card the server is unreachable.
  networks = [fiberax_network.internal.id]

  # A public address is billed while the project holds it. One taken with new = true is
  # released together with the server; manage it as fiberax_ip to keep it across servers.
  public_ipv4 = {
    new = true
  }

  # You must set EITHER a password OR SSH keys: a server with neither is unreachable,
  # and the platform refuses such a request.
  ssh_keys = [12]

  tags = ["prod", "web"]
}

# A type sold as plans: the plan sets the size, and the slider fields are refused.
resource "fiberax_server" "solo" {
  name           = "solo-01"
  server_type_id = 5
  image          = "fcf9f69c8630904c1d6d73a821f4e674"

  plan_id  = 15
  networks = [fiberax_network.internal.id]
  ssh_keys = [12]
}

# Power is described by a FIELD, and it has three values: true - keep it on,
# false - keep it off, NOT SET - the provider does not manage power at all.
#
# The third state is load-bearing: without it a run would silently start a server
# you powered off yourself, and resume the charges for cores and memory.
resource "fiberax_server" "cold_standby" {
  name           = "standby-01"
  server_type_id = 4
  image          = "fcf9f69c8630904c1d6d73a821f4e674"

  cores     = 1
  memory_mb = 1024
  disk_gb   = 10
  networks  = [fiberax_network.internal.id]
  ssh_keys  = [12]

  started = false

  timeouts {
    create = "30m"
    update = "30m"
    delete = "20m"
  }
}

Schema

Required

Optional

NOTE: Write-only arguments are supported in Terraform 1.11 and later.

The disk ONLY GROWS: the platform cannot shrink it, and a request for a smaller size is rejected.

Chosen at creation only: moving a system disk between storage classes is not an operation of the platform.

A server of this kind NEVER CHANGES SIZE: neither the package nor cores, memory or disk can be edited, so a different package means a different server.

model is the key from gpu_models of the type's pricing; naming the same model twice adds the counts up. How many cards one server may hold is limits.gpus of that pricing.

THE SET CANNOT BE CHANGED on an existing server - a different set means a different server, and the provider expresses that by replacing the resource. (see below for nested schema)

Accepted only on server types that name their hosts; a type that does not refuses it. A chosen host with no room for this server is refused - the server is NEVER placed on another host silently.

THE HOST CANNOT BE CHANGED on an existing server: a different host means a different server, and the provider expresses that by replacing the resource. Where the server runs right now is current_host, and a move made outside Terraform changes that one, not this one.

The name of a NEW server is a host name: parts separated by single dots, each made of Latin letters, digits and hyphens and not starting or ending with a hyphen (web-1.example; not a..b, not a.-b). The plan of a new server checks this; a rename is checked by the platform.

The provider asks for the name AT PLAN TIME whenever the configuration also names password or ssh_keys - a router needs neither, so such a configuration cannot be a router. A configuration with no name, no password and no keys is left to the platform: from here it is indistinguishable from a router, and the platform answers name_required itself.

The field IS NOT RECONCILED with state: the server record does not report private networks, and deriving them from the card list would report every card added by a separate resource as drift.

AT LEAST ONE NETWORK IS REQUIRED - this field, or public_ipv4, or both. The provider refuses a server with neither AT PLAN TIME; the platform refuses it too (network_required), because a server with no network card is unreachable.

The rules for a new server (this one, name, password and ssh_keys, the server type, image and plan) are checked whenever a plan creates a server - the new server of a replacement too - and again on apply before anything is ordered. A value known only during apply (an expression of a resource created in the same run) is checked only then, and in a replacement that is AFTER the old server is destroyed; the plan warns about it. The safe way is to apply the resource the value comes from first (terraform apply -target=...); create_before_destroy helps only when it is set on the server AND on every resource that takes server_id from it - see the guide "A project end to end". A plain terraform destroy plans the configuration first, and a server that is no longer in state (destroyed alone, or deleted outside Terraform) is planned as new: if a configuration without a network stops the destroy this way, run terraform destroy -refresh=false, or remove the server from the configuration.

A Windows server needs a password in any case: SSH keys do not work on Windows.

Set EITHER the password OR keys (ssh_keys, ssh_public_keys) - a server with neither is unreachable, and the platform rejects such a request (credentials_required). The provider asks for one of the two AT PLAN TIME whenever the configuration names name: a router is the only image that needs neither, and a router is not given a name either.

The field is WRITE-ONLY: the password goes neither into the plan nor into state (the state file keeps everything in clear text), and the public API does not return it. It is applied only at creation.

A plan change goes ONLY UP and ONLY on a stopped server - the provider stops it itself and starts it back if it was running. A change the platform refuses anyway (no such plan, a smaller one) is refused before the server is stopped. The platform cannot downgrade: to move to a smaller plan, the server has to be recreated.

WHAT HAPPENS TO THE ADDRESS WHEN THE SERVER IS DESTROYED depends on the form. new = true: the address was born with the server and goes back to the platform's shared pool when the server is destroyed (or replaced) - it is not billed any more, and it cannot be taken back; a replacement releases it before the new server is created, and the new server takes a free address from the shared pool, which may or may not be the same one - do not rely on keeping it (the plan warns about this for a change in the configuration, not for -replace or taint). id and reuse: the address stays with the project, billed, until you release it - with id it is usually a fiberax_ip resource that destroy releases itself, and on replacement it moves to the new server. With new = true the platform releases EVERY public address attached to the server at that moment, including one attached outside this configuration. An address reuse had to allocate new is kept just the same. Without the block (an imported server included) the addresses are kept as well. This is how 0.7.0 and later behave: 0.6.0 and earlier send no choice, and the platform then releases every address of the destroyed or replaced server, whatever the form.

CHANGING THE FORM on an existing server replaces the server - a new one is created from the image and the disks of the old one are erased; removing the block does not replace anything. ADDING the block to a server Terraform created - without it, or after it was removed - is a change of form too and replaces the server. Only a server taken over with terraform import is different, and only until the first successful apply whose plan shows a change for it: a block written by then is recorded in state and replaces nothing. That apply ends the allowance even when its change only records values in state; an apply with no change for the server (a refresh, changes to other resources) does not. From then on adding the block replaces the server, and the plan shows it only as the usual "forces replacement".

A switch from new = true to reuse, or to id of the server's own address, is refused at plan time, because the replacement would release that address first. To keep such an address, remove the block (the address then stays with the project, still billed) and, to manage it, import it as a fiberax_ip and give the server depends_on on that resource, so that destroy deletes the server before releasing the address - the server is not replaced; the guide "Public addresses and what they cost" gives the steps. That dependency, like id = fiberax_ip.<name>.id, also makes terraform destroy -target=fiberax_ip.<name> delete the server with its disks: to release only the address later, first remove depends_on (or the block) and apply, then take the address off net0, the card the server was created with, outside Terraform - PATCH /v1/servers/{id}/network-interfaces/net0 with {"ips": []}, or the client area; a running server restarts once and is left without a public IPv4 address - and then remove the fiberax_ip from the configuration and apply; with no fiberax_ip for the address (a server with new = true) release it with DELETE /v1/ips/{id} - a fiberax_ip written without terraform import takes a NEW billed address. No resource manages net0 for taking addresses off it, and removing the block only changes state; the guide gives the steps. A switch from new = true to id of another address is planned with a warning: the old address goes back to the shared pool. From reuse or id to another form the old address stays with the project, billed, until you release it.

The provider refuses a block that names more than one form at plan time, even when the extra field is false (id = 5 together with new = false is refused). The platform itself only rejects a block where more than one form is TRUE; the provider is deliberately stricter so that the description reads as a single unambiguous choice. (see below for nested schema)

The field is WRITE-ONLY: the values go neither into the plan nor into state - some of them are application passwords, and the state file keeps everything in clear text. The platform does not return them either, and they are applied only at creation.

The field IS NOT RECONCILED with state: the server record does not report the installed keys. Keys can be added to an existing server with an API operation, but not with this field.

CHANGING THE LIST NEVER RECREATES THE SERVER and does not touch it: the new list is only recorded in state, and the plan says so with a warning. Keys removed from the list stay in the guest, and keys added to it are not installed - add them with POST /v1/servers/{id}/actions/add-ssh-keys, remove them inside the guest (~/.ssh/authorized_keys). The usual cause of such a change needs nothing at all: a fiberax_ssh_key renamed in the configuration, or deleted from the pool and created again, comes back with a new ID and the same material the guest already trusts.

Sensitive: the plan does not print them. The server record does not return the text - it reports the installed keys as fingerprints only - so the field IS NOT RECONCILED with state, the same as ssh_keys.

CHANGING THE SET NEVER RECREATES THE SERVER and does not touch it: the new set is only recorded in state, and the plan says so with a warning. To add a key to a running server, call POST /v1/servers/{id}/actions/add-ssh-keys with ssh_public_keys; to give the server a new set of keys, reinstall it with POST /v1/servers/{id}/actions/rebuild and ssh_public_keys - the reinstalled system gets exactly the keys sent.

The third value is load-bearing here, not a convenience: without it a run would silently power on a server you shut down yourself, and resume the charges for CPU and memory.

A server the platform is starting (status = "starting") reads as true, one it is stopping (stopping, shutdown) as false: the plan does not ask to power on a server that is already starting. If a start never completes (a platform task that did not run), the server keeps reading true while status stays starting, and Terraform does not start it again - check status.

No more than ten per server, counting the ones created in the client area. The platform compares labels CASE-INSENSITIVELY and rewrites the spelling of an existing one to match what you sent. Platform labels (those with hb-) are not shown and cannot be changed.

Because one label is kept and its spelling is rewritten, a configuration that lists TWO SPELLINGS of the same label (["prod", "Prod"]) can never converge: every apply would rewrite the spelling and the next plan would ask for the change again. The provider refuses such a configuration AT PLAN TIME, naming both spellings. Different labels that merely differ in case (LLM and gpu) are fine. A plain terraform destroy plans the configuration first and stops on this refusal too: fix the spelling, or destroy with terraform destroy -refresh=false.

Read-Only

OBSERVED, not declared: a move by an operator changes it, and Terraform does not move the server back. During a REINSTALL the platform moves the card marks to the new machine and the label reads empty for a while - the previous value is kept until the task is done.

During a REINSTALL the platform moves the marks from the old machine to the new one, and in that window the list reads empty - the previous value is kept until the task is done. (see below for nested schema)

unknown means the platform could not name the status, and is NOT an error; there is no need to recreate the server because of it.

Nested Schema for gpus

Required:

Nested Schema for public_ipv4

Optional:

Nested Schema for timeouts

Optional:

Nested Schema for gpu_cards

Read-Only:

Nested Schema for ips

Read-Only:

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# An existing server is imported by its ID. The ID is visible in the client area and in
# the response of GET /v1/servers.
terraform import fiberax_server.web 10851

# WHAT YOU HAVE TO WRITE BY HAND. The platform does not report back the server's private
# networks, the installed SSH keys, the password, the licence acceptance or the setup
# values - an imported server holds none of these in state. The provider does not invent
# them: a configuration is meant to match reality, not to look as if it does.
#
# Adding such values to the configuration causes NO recreation: nothing to compare against.

Generated from the provider schema for version 0.11.0. How to install the provider: Terraform provider.