Infrastructure as Code (Terraform)
Manage Liviate servers, networks and managed databases with the liviatehq/liviate Terraform provider.
Liviate's cloud API is a CloudStack-compatible API, so you can manage servers, networks,
volumes and managed databases as code with the official liviatehq/liviate Terraform provider.
Install the provider
terraform {
required_providers {
liviate = {
source = "liviatehq/liviate"
version = ">= 1.0.0"
}
}
}
provider "liviate" {
api_url = "https://console.liviate.com/client/api"
api_key = var.api_key
secret_key = var.secret_key
}
Create the API key + secret in the console under Inference → API Keys (or your account's API credentials page), and pass them as variables — never commit them.
Create a server
resource "liviate_instance" "web" {
name = "web-1"
service_offering = "liviate-vcpu-2-4gb-20260903-01"
template = var.template_id # a Debian/Ubuntu template id
zone = var.zone_id
network_id = var.network_id
keypair = "my-key"
user_data = file("cloud-init.yaml") # optional
expunge = true # fully remove on destroy
}
output "ip" {
value = liviate_instance.web.ip_address
}
For an appliance or any image that needs several NICs at boot, use the ordered network_ids
(one NIC per entry, in template order) instead of a single network_id.
Managed databases
liviate_managed_database provisions a logical database + credential on a shared managed engine
(PostgreSQL or MariaDB). The credential is minted on demand and is not stored in Terraform
state:
resource "liviate_managed_database" "app" {
engine = "mariadb" # or "postgresql"
tenant = var.tenant
name = "appdb"
}
Configure the managed-DB endpoint on the provider block (mariadb_api_url / mariadb_api_token,
or the postgres_* equivalents). Managed databases require TLS — connect with your client's
SSL option enabled and verify against the database's CA (downloadable from the credential view in
the console).
Next steps
- Keep credentials in a
terraform.tfvarsthat is gitignored, or in your CI's secret store. - Use
expunge = trueon throwaway resources soterraform destroyleaves nothing billable behind. - Pin the provider version and review
terraform planbefore every apply.