SiteHost

Terraform Provider

Terraform is an open-source infrastructure as code software tool created by HashiCorp. Users define and provide data center infrastructure using a declarative configuration language known as HashiCorp Configuration Language, or optionally JSON.

Create an Example Server

Create a new Linux 1.5GB VPS XENLIT in Auckland, NZ AKLCITY with Ubuntu Jammy ubuntu-jammy-pvh.amd64.

  1. Create a main.tf file with this content.
terraform {
    required_providers {
        sitehost = {
            source = "sitehostnz/sitehost"
            version = "~> 1.0"
        }
    }
}

provider "sitehost" {
    client_id = "****"
    api_key = "***"
    api_endpoint = "https://api.sitehost.nz/1.1/"
}

resource "sitehost_server" "web" {
    label = "webserver"
    location = "AKLCITY"
    product_code = "XENLIT"
    image = "ubuntu-jammy-pvh.amd64"
}

To get an API KEY you must create it from your Sitehost control panel. You can find out how to do this in our knowledge base.

  1. Run the terraform commands to create the VPS
terraform init && terraform apply --auto-approve

Delete an Example Server

Run the terraform commands to delete the VPS

terraform destroy --auto-approve

Be aware this command cannot be reversed and will completely remove the server.

Values for Location, Product Code and Image

You can check the complete list with all locations, product codes and images available to deploy a Linux/Windows VPS using our terraform provider

Complete Documentation

You can see the complete documentation about our provider on Terraform Registry.