Tembo has a Terraform Provider that allows you to provision an Instance on the Tembo Cloud.
Requirements
- Terraform >= 1.0
Authentication
Tembo Terraform Provider needs an access_token to authenticate with the API. Generate a long-lived API token by following steps here.
Note: To set access_token either create a local .tfvars file with the variable or set an environment variable with the access_token as shown below.
export TEMBO_ACCESS_TOKEN="TOKEN_GOES_HERE"
Example Usage
terraform {
required_providers {
tembo = {
source = "tembo-io/tembo"
}
}
}
provider "tembo" {
access_token = var.access_token
}
variable "access_token" {
type = string
}
tembo_instance (Resource)
Resource for creating a tembo instance.
Example Usage
resource "tembo_instance" "test_instance" {
instance_name = "test-instance"
org_id = "org_test" # Replace this with your org_id
cpu = "1"
stack_type = "Standard"
environment = "dev"
memory = "4Gi"
storage = "10Gi"
replicas = 1
# extra_domains_rw = ["sample-invalid-domain.test.tembo-development.com"]
postgres_configs = [
{
name = "max_connections"
value = "200"
},
{
name = "wal_buffers"
value = "10"
}
]
trunk_installs = [
{
name = "pgmq"
version = "0.24.0"
}
]
extensions = [{
name = "plperl"
description = "PL/Perl procedural language"
locations = [{
database = "app"
schema = "public"
version = "1.0"
enabled = false
},
{
database = "postgres"
schema = "public"
version = "1.0"
enabled = true
}]
},
{
"name" : "pltclu",
"description" : "PL/TclU untrusted procedural language",
"locations" : [
{
"database" : "app",
"schema" : "public",
"version" : "1.0",
"enabled" : false,
"error" : false,
"error_message" : null
},
{
"database" : "postgres",
"schema" : "public",
"version" : "1.0",
"enabled" : false,
"error" : false,
"error_message" : null
}
]
}]
}
output "instance" {
value = tembo_instance.test_instance
}
Schema
Required
cpu(String) CPU. Supported values: 1, 2, 4, 8, 16, 32environment(String) Environment. Values supported: dev, test, prodinstance_name(String) Unique name of the instancememory(String) Memory. Values supported: 1Gi, 2Gi, 4Gi, 8Gi, 16Gi, 32Giorg_id(String) Id of the organization in which the instance will be createdstack_type(String) Stack type for the instance. Supported values: Standard, MessageQueue, MachineLearning, OLAP, OLTPstorage(String) Storage. Values supported: 10Gi, 50Gi, 100Gi, 200Gi, 300Gi, 400Gi, 500Gi
Optional
extensions(Attributes List) Extensions to install in the instance (see below for nested schema)extra_domains_rw(List of String) Custom domain. Read more herepostgres_configs(Attributes List) Postgres config values (see below for nested schema)replicas(Number) Instance replicastrunk_installs(Attributes List) Trunk installs (see below for nested schema)
Read-Only
instance_id(String) Unique ID for the instance generated by Tembolast_updated(String) Last updated date time in UTCstate(String) Instance state. Values: Submitted, Up, Configuring, Error, Restarting, Starting, Stopping, Stopped, Deleting, Deleted
Nested Schema for extensions
Required:
locations(Attributes List) (see below for nested schema)name(String)
Optional:
description(String)
Nested Schema for extensions.locations
Required:
database(String)enabled(Boolean)
Optional:
schema(String)version(String)
Nested Schema for postgres_configs
Required:
name(String)
Optional:
value(String)
Nested Schema for trunk_installs
Required:
name(String)
Optional:
version(String)