You need:

  • Terraform โ‰ฅ 1.5 on your $PATH.
  • An Excloud account, and one of:
    • The exc CLI logged in (exc login), OR
    • An API key (exc apikey create) and your org ID (exc me).

1. Project skeleton

mkdir excloud-tf-quickstart && cd excloud-tf-quickstart

Create main.tf:

terraform {
  required_providers {
    excloud = {
      source  = "excloud-dev/excloud"
      version = "~> 0.2"
    }
  }
}

provider "excloud" {
  # Reads ~/.exc/config from `exc login` automatically.
  # Override with explicit attributes or env vars in CI.
}

data "excloud_compute_images" "all" {}
data "excloud_instance_types" "all" {}
data "excloud_subnets" "zone_1" {
  zone_id = 1
}

locals {
  ubuntu  = one([for i in data.excloud_compute_images.all.images : i if i.name == "ubuntu-24.04-latest"])
  size    = one([for t in data.excloud_instance_types.all.instance_types : t if t.name == "t1a.micro"])
  subnet  = one([for s in data.excloud_subnets.zone_1.subnets : s if s.name == "DEFAULT"])
}

resource "excloud_ssh_key" "demo" {
  name       = "tf-quickstart"
  public_key = file("~/.ssh/id_ed25519.pub")
}

resource "excloud_compute_instance" "demo" {
  name                 = "tf-quickstart"
  zone_id              = local.subnet.zone_id
  subnet_id            = local.subnet.id
  image_id             = local.ubuntu.id
  instance_type        = local.size.name
  allocate_public_ipv4 = true
  ssh_pubkey           = excloud_ssh_key.demo.public_key

  root_volume = {
    name     = "tf-quickstart-root"
    size_gib = 10
  }
}

output "instance_id" {
  value = excloud_compute_instance.demo.id
}

output "public_ipv4" {
  value = excloud_compute_instance.demo.public_ipv4
}

2. Init

terraform init

Terraform downloads the provider from the public registry.

3. Plan

terraform plan

You’ll see:

  • excloud_ssh_key.demo will be created.
  • excloud_compute_instance.demo will be created.

Nothing is billable until you apply.

4. Apply

terraform apply

Terraform creates the resources and polls until the VM reaches running (about 30s for a t1a.micro).

The public_ipv4 output is the address you can ssh ubuntu@โ€ฆ into using the key you registered.

5. Make a change

Resize the VM by editing main.tf:

-  instance_type        = local.size.name
+  instance_type        = "m1a.large"
terraform apply

Terraform stops the VM, resizes it, and starts it again โ€” without disturbing the root volume.

6. Destroy

terraform destroy

Confirms, then removes the VM and the SSH key record. The ephemeral public IPv4 is released with the VM.

Switching to CI auth

In CI you don’t have exc login. Provide credentials via env vars:

export EXCLOUD_API_KEY=...        # from `exc apikey create`
export EXCLOUD_ORG_ID=...         # from `exc me`
terraform plan

โ€ฆor by setting them explicitly in the provider block:

provider "excloud" {
  api_key = var.excloud_api_key
  org_id  = var.excloud_org_id
}

Next