Provision and manage Hostinger VPS instances effortlessly using Terraform.
This provider integrates with Hostinger's Public API to manage VPS servers, post-install scripts, and SSH keys. It supports in-place updates, advanced validation, and optional configuration for security and automation.
⚡ Production-ready and developer-focused — built to meet the standards of modern cloud provisioning.
- ✅ Create and delete VPS servers
- 🔄 In-place updates for hostname, SSH keys, OS template
- 🔐 Attach SSH keys (inline or existing)
- 📜 Upload post-install scripts
- 🔎 Validate
plan
,template_id
, anddata_center_id
before provisioning - 🧠 Auto-detect default payment method
- 💥 Cancellation triggers actual subscription deletion via Hostinger Billing API
- Terraform ≥ 1.3.0
- Hostinger API Token (bearer) - obtainable from your Hostinger account under the API section
- A valid payment method added to your Hostinger account — either Google Pay (Credit Card) or PayPal
In your terraform config, define hostinger/hostinger
in your required_providers and set your API key:
terraform {
required_providers {
hostinger = {
source = "hostinger/hostinger"
version = "0.1.3"
}
}
}
provider "hostinger" {
api_token = "YOUR_SECRET_TOKEN"
}
resource "hostinger_vps_ssh_key" "inline_key" {
name = "My SSH Key"
key = "ssh-rsa AAAAB3... user@host"
}
resource "hostinger_vps_post_install_script" "nginx" {
name = "NGINX Script"
content = <<-EOT
#!/bin/bash
apt-get update
apt-get install -y nginx
EOT
}
resource "hostinger_vps" "web" {
plan = "hostingercom-vps-kvm2-usd-1m"
data_center_id = 13
template_id = 1002
hostname = "web01.example.com"
ssh_key_ids = [hostinger_vps_ssh_key.inline_key.id]
post_install_script_id = hostinger_vps_post_install_script.nginx.id
}
output "vps_ip" {
value = hostinger_vps.web.ipv4_address
}
data "hostinger_vps_templates" "all" {}
data "hostinger_vps_data_centers" "all" {}
data "hostinger_vps_plans" "all" {}
output "available_templates" {
value = data.hostinger_vps_templates.all.templates
}
hostinger_vps
— Provisions a VPShostinger_vps_ssh_key
— Manages account-level SSH keyshostinger_vps_post_install_script
— Upload post-install scripts
HOSTINGER_API_TOKEN
(optional) – Alternative to passingapi_token
in the provider block.
To build:
go build -o terraform-provider-hostinger
To test locally:
terraform init
terraform plan
terraform apply
Pull requests and issues are welcome. We aim to build the most user-friendly Hostinger provider on the Terraform Registry.
If you encounter any bugs or unexpected behavior, please open an issue.
Our team actively monitors reports and strives to address them promptly to ensure a stable and reliable experience for all users.
Hostinger Engineering