Terraform provider
The ariaservice/arianet Terraform provider manages Arianet Cloud resources as code: servers, volumes, private networks (subnets, routes), firewalls, floating IPs, load balancers (services, targets) and your account's SSH keys. It needs Terraform 1.0 or newer.
- Registry: registry.terraform.io/providers/ariaservice/arianet (current version 0.1.0)
- Source: github.com/ariaservice/terraform-provider-arianet
- Product page: ariaservice.net/developers/terraform
The provider calls the Cloud API; the full schema of every resource is on the registry.
Provider setup
terraform {
required_providers {
arianet = {
source = "ariaservice/arianet"
version = "~> 0.1"
}
}
}
provider "arianet" {
# Read from ARIANET_TOKEN when not set here.
token = var.arianet_token
}
variable "arianet_token" {
type = string
sensitive = true
}
Then run terraform init.
Authentication
Create a personal API token at cloud.ariaservice.net/users/api-tokens with the scopes cloud:servers:read and cloud:servers:write (add the SSH key scopes ssh-keys:read / ssh-keys:write if you manage arianet_ssh_key). Keep it out of your code: export it instead of writing it in a .tf file.
export ARIANET_TOKEN="paste-your-token-here"
terraform plan
Provider arguments
| Argument | Environment variable | Default | Meaning |
|---|---|---|---|
token | ARIANET_TOKEN | required | API token (sensitive) |
endpoint | ARIANET_API_URL | https://api.ariaservice.net | API root URL. Must be https (plain http only for localhost) |
poll_interval | 2s | Wait between polls of a running action; grows up to 10s | |
max_retries | 5 | Retries on HTTP 429 (honouring Retry-After, else RateLimit-Reset) and, for reads, on 502/503/504 |
Long operations return an action; the provider waits for it, bounded by each resource's timeouts block (for example timeouts { create = "20m" }). A resource that answers 404 on refresh is removed from the state.
Resources
| Resource | Manages |
|---|---|
arianet_server | A cloud server. Changing plan_id resizes it in place; backups turns daily backups on or off; keep_backups / delete_snapshots decide what happens to its copies on destroy. |
arianet_volume | A block storage volume (size in GB; growing resizes in place). |
arianet_volume_attachment | Attaches a volume to a server. |
arianet_network | A private network (ip_range, optional first subnet_ip_range). |
arianet_network_subnet | An extra subnet of a network. |
arianet_network_route | A static route (destination → gateway) of a network. |
arianet_firewall | A firewall with its rule blocks and optional apply_to (servers or label selectors). |
arianet_firewall_attachment | Applies a firewall to servers (server_ids) or label selectors (label_selectors). |
arianet_floating_ip | A floating IPv4 or IPv6 address, optional server_id and reverse DNS (dns_ptr). |
arianet_floating_ip_assignment | Assigns a floating IP to a server. |
arianet_load_balancer | A load balancer (type such as lb11, algorithm, optional network_id, public_interface). |
arianet_load_balancer_service | A listener: protocol (tcp, http, https passthrough), ports, health_check, http options. |
arianet_load_balancer_target | A target: a server, an IP or a label selector, optionally over the private network. |
arianet_ssh_key | An SSH key of your account. |
Every resource supports terraform import, for example terraform import arianet_server.web 123 (sub-resources use compound IDs such as 21/80 for a load balancer service).
Resources that have them accept labels (a map), project_id (defaults to the account's default project; changing it moves the resource) and protection_delete (must be false before the resource can be destroyed).
arianet_server arguments
| Argument | Notes |
|---|---|
name, datacenter, plan_id, image | Required. datacenter is a location code (arianet_locations), image a slug such as ubuntu-24.04 or a snapshot/backup reference (arianet_image(s)). Changing datacenter or image replaces the server. |
ssh_key_ids, ssh_keys | Saved key IDs and/or public keys installed at creation |
user_data | cloud-init user data |
enable_ipv4, enable_ipv6 | Public addresses (IPv4 is on by default) |
firewall_ids, network_ids | Firewalls applied directly; private networks attached at creation |
backups | Daily backups (billed extra) |
keep_backups | On destroy, keep the finished backups (billed per GB afterwards). Sent as ?keep_backups=true. |
delete_snapshots | On destroy, also delete the server's snapshots, which otherwise stay billed. Sent as ?delete_snapshots=true. |
start_after_create, protection_delete, protection_rebuild, labels, project_id |
Read-only: ipv4_address, ipv6_address, status, disk_gb, locked, rescue_enabled, and root_password (sensitive, returned once at creation; empty when SSH keys are used and the API returns none). Set keep_backups / delete_snapshots and apply before terraform destroy; they are read from the state when the server is deleted.
Data sources
| Data source | Returns |
|---|---|
arianet_locations | Datacenters: code, name, country, features, orderable |
arianet_plans | Plans (optionally per datacenter): id, name, vcpu, ram_mb, disk_gb, traffic_gb, hourly_price, monthly_price, available |
arianet_images, arianet_image | Images by type (system, app, snapshot, backup), datacenter, label_selector; arianet_image picks one by id, image, name or most_recent |
arianet_pricing | The public price list (/cloud/v1/public/pricing): server_types with per-location prices, other resources, vat_included |
arianet_server_costs | GET /servers/{id}/costs: cost lines, totals, snapshots, kept_backups |
arianet_load_balancer_types | Load balancer types and their limits |
arianet_server, arianet_network | Look up an existing resource by id, name or label_selector |
arianet_ssh_key | Look up one of your SSH keys by id, name or fingerprint |
Complete example
A private network, three web servers behind a load balancer, a firewall that follows the role=web label, and a data volume:
terraform {
required_providers {
arianet = {
source = "ariaservice/arianet"
version = "~> 0.1"
}
}
}
provider "arianet" {} # token from ARIANET_TOKEN
locals {
datacenter = "ovh"
}
data "arianet_plans" "dc" {
datacenter = local.datacenter
}
resource "arianet_ssh_key" "me" {
name = "laptop"
public_key = file("~/.ssh/id_ed25519.pub")
}
resource "arianet_network" "private" {
name = "private"
datacenter = local.datacenter
ip_range = "10.0.0.0/16"
subnet_ip_range = "10.0.1.0/24"
}
resource "arianet_server" "web" {
count = 3
name = "web-${count.index + 1}"
datacenter = local.datacenter
plan_id = data.arianet_plans.dc.plans[0].id
image = "ubuntu-24.04"
ssh_key_ids = [arianet_ssh_key.me.id]
network_ids = [arianet_network.private.id]
labels = { role = "web" }
user_data = <<-EOT
#cloud-config
packages: [nginx]
EOT
}
resource "arianet_firewall" "web" {
name = "web"
rule {
direction = "in"
protocol = "tcp"
port = "22"
source_ips = ["203.0.113.4/32"]
}
rule {
direction = "in"
protocol = "tcp"
port = "80"
source_ips = ["0.0.0.0/0", "::/0"]
}
apply_to = [{ label_selector = "role=web" }]
}
resource "arianet_load_balancer" "web" {
name = "web"
datacenter = local.datacenter
type = "lb11"
algorithm = "round_robin"
network_id = arianet_network.private.id
}
resource "arianet_load_balancer_service" "http" {
load_balancer_id = arianet_load_balancer.web.id
protocol = "http"
listen_port = 80
destination_port = 80
health_check = {
protocol = "http"
port = 80
interval = 10
timeout = 5
retries = 3
http = {
path = "/"
status_codes = ["2??"]
}
}
}
resource "arianet_load_balancer_target" "web" {
load_balancer_id = arianet_load_balancer.web.id
type = "label_selector"
label_selector = "role=web"
use_private_ip = true
}
resource "arianet_volume" "data" {
name = "data"
datacenter = local.datacenter
size = 50
filesystem = "ext4"
}
resource "arianet_volume_attachment" "data" {
volume_id = arianet_volume.data.id
server_id = arianet_server.web[0].id
}
data "arianet_server_costs" "web1" {
server_id = arianet_server.web[0].id
}
output "load_balancer_ip" {
value = arianet_load_balancer.web.ipv4
}
output "web1_monthly_cost" {
value = data.arianet_server_costs.web1.totals
}
export ARIANET_TOKEN="..."
terraform init
terraform plan
terraform apply
Prices before you apply: curl -s https://api.ariaservice.net/cloud/v1/public/pricing or arianet cloud pricing (no token needed).
See also
- Cloud API · CLI (
arianet cloud ...) - Per-resource documentation on the Terraform Registry