VxCloud
Docs/SDKs/Terraform Provider
Terraform 1.3+ · v1.0.0-beta3

Terraform Provider

Manage VxCloud workspaces, credentials, VMs, databases, deploys, and Kubernetes clusters as Terraform-native resources. Full import support; state diffs against the live platform.

7 modules — every method shipped in v1.0.0-beta3 is documented below with a runnable example.

Terraform Provider

Terraform 1.3+v1.0.0-beta3 · 7 modules

Manage VxCloud workspaces, credentials, VMs, databases, deploys, and Kubernetes clusters as Terraform-native resources. Full import support; state diffs against the live platform.

Install

install · terraformbash
terraform {
required_providers {
VxCloud = {
source = "VxCloud/VxCloud"
version = "~> 1.0"
}
}
}

Quickstart

main.tfhcl
provider "VxCloud" {
api_key = var.VxCloud_api_key
workspace = var.workspace_id
}
resource "VxCloud_aws_credentials" "main" {
access_key_id = var.aws_access_key_id
secret_access_key = var.aws_secret_access_key
region = "us-east-1"
}
resource "VxCloud_vm" "api" {
provider = "aws"
instance_type = "t3.small"
region = "us-east-1"
key_pair_name = "AWSPRODKEY2"
tags = { app = "studio-backend" }
depends_on = [VxCloud_aws_credentials.main]
}
output "api_ip" { value = VxCloud_vm.api.public_ip }

Modules

Provider configuration

The provider authenticates with an API key; workspace_id is optional and inferred from the key by default.

1provider "VxCloud" {
2 api_key = var.VxCloud_api_key
3 workspace = var.workspace_id # optional
4 # node_url = "https://node1.vxcloud.io" # override active node
5}
1 example
vxsdk

Cloud credentials

Store Alibaba / AWS / Azure / Google Cloud / Linode credentials in Vault as Terraform-managed resources.

1resource "VxCloud_aws_credentials" "main" {
2 access_key_id = var.aws_access_key_id
3 secret_access_key = var.aws_secret_access_key
4 region = "us-east-1"
5}
6
7resource "VxCloud_gcp_credentials" "main" {
8 project_id = "my-project"
9 service_account_key = file("${path.module}/sa.json")
10}
11
12resource "VxCloud_azure_credentials" "main" {
13 client_id = var.azure_client_id
14 client_secret = var.azure_client_secret
15 tenant_id = var.azure_tenant_id
16 subscription_id = var.azure_subscription_id
17}
1 example
vxsdk

VMs

AWS / GCP / Azure VM lifecycle.

1resource "VxCloud_vm" "web" {
2 provider = "aws"
3 instance_type = "t3.medium"
4 region = "us-east-1"
5 key_pair_name = "AWSPRODKEY2"
6 tags = {
7 env = "production"
8 team = "platform"
9 }
10}
11
12output "web_ip" { value = VxCloud_vm.web.public_ip }
1 example
vxsdk

Databases

Postgres / MySQL / MongoDB managed databases.

1resource "VxCloud_database" "app_db" {
2 provider = "aws"
3 engine = "postgresql"
4 instance_class = "db.t3.medium"
5 storage_gb = 100
6 depends_on = [VxCloud_aws_credentials.main]
7}
8
9output "db_url" { value = VxCloud_database.app_db.connection_string }
1 example
vxsdk

Application deploys

Deploy applications onto a previously-provisioned VM. Same surface as the SDK's deploy module — exposed as a Terraform resource for declarative state.

1resource "VxCloud_deploy_fastapi" "api" {
2 source_dir = "./"
3 app_name = "studio-backend"
4 entry = "app.app:app"
5 requirements = "requirements.txt"
6 app_port = 8000
7 http_port = 80
8 host = VxCloud_vm.api.public_ip
9 ssh_user = "ubuntu"
10 key_pair_name = "AWSPRODKEY1.PEM"
11
12 env_vars = {
13 DATABASE_URL = VxCloud_database.app_db.connection_string
14 }
15
16 depends_on = [VxCloud_vm.api, VxCloud_database.app_db]
17}
1 example
vxsdk

Kubernetes

EKS / GKE / AKS clusters.

1resource "VxCloud_kubernetes_cluster" "prod" {
2 provider = "aws"
3 cluster_name = "prod-cluster"
4 node_count = 3
5 node_type = "t3.large"
6 region = "us-east-1"
7}
8
9output "kubeconfig" {
10 value = VxCloud_kubernetes_cluster.prod.kubeconfig
11 sensitive = true
12}
1 example
vxsdk

Importing existing resources

Bring an already-running resource under Terraform management.

1# 1. Declare the resource (empty body):
2resource "VxCloud_vm" "imported" {
3 provider = "aws"
4 instance_type = "t3.small"
5 region = "us-east-1"
6}
7
8# 2. Import — `terraform plan` should report no drift afterwards:
9# terraform import VxCloud_vm.imported i-0abc123def456
1 example
vxsdk