Terraform provider reference / guides / getting-started
Getting started
This guide takes you from nothing to a server described in configuration. It assumes you already have an account and a project; everything else is here.
1. Get a token
The token is issued in the client area, section API tokens. It belongs to ONE project, so a
setup that manages two projects needs two tokens and two provider configurations. Take an rw
token: a read one is enough to plan, but not to apply.
The secret is shown once. Put it in the environment rather than in the configuration:
export FIBERAX_TOKEN='fbx_...'
2. Install the provider
The provider is not in the public registry yet; it is served from our own mirror. Put this into
~/.terraformrc (%APPDATA%\terraform.rc on Windows):
provider_installation {
network_mirror {
url = "https://docs.fiberax.com/terraform/mirror/"
include = ["registry.terraform.io/fiberax/*"]
}
direct {
exclude = ["registry.terraform.io/fiberax/*"]
}
}
For OpenTofu the file is ~/.tofurc and the registry name is its own
(registry.opentofu.org/fiberax/*).
The trailing slash in url is required: without it the provider is reported as "not found in any of
the search locations", which reads as if it did not exist at all.
3. Describe the provider
terraform {
required_providers {
fiberax = {
source = "fiberax/fiberax"
version = "0.3.0"
}
}
}
provider "fiberax" {
# token is read from FIBERAX_TOKEN when it is omitted here
}
4. Read the catalogue instead of guessing
Server types differ in how they are sized, and the data sources tell you which is which:
data "fiberax_server_types" "all" {}
data "fiberax_images" "ubuntu" {
server_type_id = 4
}
Run terraform plan once at this point. Data sources are read during the plan, so this is the
cheapest way to check that the token, the mirror and the project all work together.
5. A first server
resource "fiberax_ssh_key" "laptop" {
name = "laptop"
public_key = file("~/.ssh/id_ed25519.pub")
}
resource "fiberax_server" "web" {
name = "web-01"
server_type_id = 4
image = "fcf9f69c8630904c1d6d73a821f4e674"
cores = 2
memory_mb = 4096
disk_gb = 40
public_ipv4 = { reuse = true }
ssh_keys = [fiberax_ssh_key.laptop.id]
}
output "address" {
value = fiberax_server.web.ipv4
}
public_ipv4 = { reuse = true } takes a free address the project already pays for and only
allocates a new one when there is none. Prefer it to { new = true } in anything you apply more
than once.
6. Apply, and then look
terraform apply
Creation is asynchronous on the platform, and the provider waits for it: when apply returns, the
server exists and its address is in the output. What the provider does NOT wait for is the operating
system inside the server finishing its own start-up.
Where to go next
- A project end to end - network, server, firewall and backups in one configuration.
- Importing what you already have - bringing existing servers under Terraform.
- Retries, 409 and 503 - what the provider repeats on its own and what it does not.
- The API reference and guides: https://docs.fiberax.com/.
Generated from the provider schema for version 0.3.0. How to install the provider: Terraform provider.