terraform-provider-hostinger
Terraform Hostinger Provider
0
Stars
0
Forks
0
Watchers
0
Issues
110
Size (KB)
main
Branch
Files
Source on GitHubBrowse the folder structure on GitHub
File tree for this repository will appear here after the next data sync. Meanwhile you can open the full folder listing directly on GitHub.
README.md
View raw on GitHub →Terraform Provider: Hostinger VPS
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.
---
Features
- ✅ Create and delete VPS servers
- 🔄 In-place updates for hostname, SSH keys, OS template
- 📦 Import existing VPS instances with automatic configuration retrieval
- 🔐 Attach SSH keys (inline or existing)
- 📜 Upload post-install scripts
- 🔎 Validate
plan,template_id, anddata_center_idbefore provisioning
- 🧠 Auto-detect default payment method
- 💥 Cancellation triggers actual subscription deletion via Hostinger Billing API
- 🌐 Manage Domain DNS zone: add, update, and remove DNS records
---
Requirements
- 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
---
Installation
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.22"
}
}
}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 Sources
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
}
---
Resource Types
hostinger_vps— Provisions a VPS
hostinger_vps_ssh_key— Manages account-level SSH keys
hostinger_vps_post_install_script— Upload post-install scripts
---
Importing Existing Resources
You can import existing VPS instances into your Terraform state. The import process automatically retrieves all configuration details including plan, data center, and template information:
# Import a VPS using its ID
terraform import hostinger_vps.my_vps 1092628
After importing, check the imported values:
terraform state show hostinger_vps.my_vps
Then add the resource to your configuration with the imported values:
resource "hostinger_vps" "my_vps" {
plan = "KVM 8" # Auto-retrieved during import
data_center_id = 22 # Auto-retrieved during import
template_id = 1141 # Auto-retrieved during import
hostname = "srv1092628.hstgr.cloud"
}
---
Environment Variables
HOSTINGER_API_TOKEN(optional) – Alternative to passingapi_tokenin the provider block.
---
Development
To build:
go build -o terraform-provider-hostinger
To test locally:
terraform init
terraform plan
terraform apply
---
Contributing
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.
---
License
---
Maintained by
Hostinger Engineering
Repository metadata
- Owner
- TEGAR-SRC
- Primary language
- Not detected
- License
- MPL-2.0
- Created
- Jun 23, 2026
- Last pushed
- Mar 19, 2026
- Last updated
- Jun 23, 2026
Clone this repository
HTTPS
git clone https://github.com/TEGAR-SRC/terraform-provider-hostinger.gitSSH
git clone git@github.com:TEGAR-SRC/terraform-provider-hostinger.git