Terraform provider reference / data sources / server_type_hosts

fiberax_server_type_hosts (Data Source)

Hosts of one server type under their labels, so a server can be placed on a named host instead of leaving the choice to the platform.

Describe the order you intend to place - the card model, how many cards, and optionally memory, disk and disk class - and every host also reports whether it fits. A host reported as fitting will accept the request, barring a race with a neighbour: the check is the same rule the platform places servers by. How much is free is not published.

Server types that do not name their hosts answer with an error, so use this data source only on a type that does.

Example Usage

# Hosts of a server type, under the labels the platform shows you.
#
# Describe the server you are about to create and every host also says whether it
# fits. A host reported as fitting will accept the request, barring a race with a
# neighbour. How much is free is not published - only whether your order fits.
data "fiberax_server_type_hosts" "gpu" {
  server_type_id = 8

  gpu_model = "l40s"
  gpus      = 1
  memory_mb = 65536
  disk_gb   = 500
  disk_type = "local"
}

# The first host that takes this server. Spread a cluster of servers over
# different hosts by picking a different element for each one.
locals {
  free_hosts = [for h in data.fiberax_server_type_hosts.gpu.hosts : h.name if h.fits]
}

resource "fiberax_server" "gpu" {
  server_type_id = 8
  image          = data.fiberax_image.ubuntu.id
  name           = "trainer-01"
  cores          = 16
  memory_mb      = 65536
  disk_gb        = 500
  disk_type      = "local"
  gpus           = [{ model = "l40s", count = 1 }]

  # Leave this out and the platform picks the host.
  host = local.free_hosts[0]

  ssh_keys = [fiberax_ssh_key.deploy.id]
}

# Where the server actually runs. It follows the server: a move made by an
# operator changes this value, not the host you asked for.
output "placed_on" { value = fiberax_server.gpu.current_host }

Schema

Required

Optional

Read-Only

Nested Schema for hosts

Read-Only:

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