Terraform provider
Describe servers, networks, load balancers and Shield rules as code with Terraform or OpenTofu.
On this page
Configure#
Export an API token and declare the provider:
Terraform
terraform {
required_providers {
avenlith = { source = "avenlith/avenlith", version = "~> 2.4" }
}
}
resource "avenlith_server" "web" {
count = 2
name = "web-0${count.index + 1}"
plan = "vps-pro"
region = "ist1"
image = "ubuntu-26.04"
labels = { role = "web" }
}
resource "avenlith_load_balancer" "web" {
name = "web-lb"
region = "ist1"
targets = avenlith_server.web[*].id
}
terraform init && terraform apply creates two servers and a load balancer in Istanbul.
Resources#
avenlith_server, avenlith_network, avenlith_firewall, avenlith_load_balancer, avenlith_floating_ip, avenlith_k8s_cluster, avenlith_db_cluster, avenlith_bucket, avenlith_shield_rule and avenlith_dns_record.
Remote state#
Store state in Avenlith object storage using the s3 backend with skip_credentials_validation = true and the regional endpoint.
Was this page helpful?
Still need help?
Our engineers answer tickets 24/7 — average first response in 7 minutes.