terraform {
required_providers {
nimbusvps = {
source = "nimbusvps/nimbusvps"
version = "~> 1.4"
}
}
}
provider "nimbusvps" {
token = var.nimbusvps_token # or NIMBUSVPS_TOKEN in the environment
}
A single server
resource "nimbusvps_server" "web" {
name = "web-01"
location = "romania"
vcpu = 3
ram_gb = 4
disk_gb = 90
image = "debian-12"
ssh_keys = [nimbusvps_ssh_key.deploy.id]
backups = "weekly"
ddos = "advanced"
user_data = file("${path.module}/cloud-init.yaml")
}
resource "nimbusvps_ssh_key" "deploy" {
name = "deploy"
public_key = file("~/.ssh/id_ed25519.pub")
}
output "ipv4" { value = nimbusvps_server.web.ipv4 }
A fleet across jurisdictions
locals {
nodes = {
"eu-1" = { location = "romania", vcpu = 4, ram = 8 }
"eu-2" = { location = "bulgaria", vcpu = 4, ram = 8 }
"is-1" = { location = "iceland", vcpu = 2, ram = 4 }
}
}
resource "nimbusvps_server" "fleet" {
for_each = local.nodes
name = each.key
location = each.value.location
vcpu = each.value.vcpu
ram_gb = each.value.ram
disk_gb = 90
image = "debian-12"
ssh_keys = [nimbusvps_ssh_key.deploy.id]
}
Spreading a fleet across jurisdictions is a two-line change here, which is the practical argument for infrastructure as code in this context.
Firewall as code
resource "nimbusvps_firewall" "web" {
name = "web"
rule {
direction = "inbound"
protocol = "tcp"
ports = "80,443"
sources = ["0.0.0.0/0", "::/0"]
}
rule {
direction = "inbound"
protocol = "tcp"
ports = "22"
sources = ["198.51.100.0/24"]
}
server_ids = [for s in nimbusvps_server.fleet : s.id]
}
Data sources
data "nimbusvps_locations" "dmca_ignored" {
filter { name = "dmca" values = ["ignored"] }
}
data "nimbusvps_image" "debian" {
slug = "debian-12"
}
The provider is published at https://github.com/nimbusvps under a permissive licence. Issues and pull requests are welcome.