Skip to main content
Crusoe Support Help Center home page
Crusoe

How To Deploy Multiple Crusoe VMs Using Instance Templates and Terraform

Rishabh Sinha
Rishabh Sinha
Updated

Last Updated: Jan 15, 2026

Introduction

You need to deploy multiple Crusoe Cloud VMs with identical configurations using Terraform, but the Instance Group feature is not available to customer accounts. You want to understand the supported method, current limitations, and how to ensure host-level distribution if required.

Prerequisites

Step-by-Step Instructions

  1. Define an Instance Template in Terraform

    resource "crusoe_instance_template" "test_template" {
      name     = "test-template"
      type     = "c1a.2x"
      subnet   = "your-subnet-id"
      ssh_key  = file("~/.ssh/id_ed25519.pub")
      location = "eu-iceland1-a"
      image    = "ubuntu22.04:latest"
      # Optional: Use placement_policy = "spread" to attempt host distribution
      # placement_policy = "spread"
      disks = [{
        size = "128GiB"
        type = "persistent-ssd"
      }]
    }
  2. Create Multiple VMs Using the Template

    resource "crusoe_compute_instance_by_template" "test_instances" {
      count             = 2
      name_prefix       = "node-${count.index}"
      instance_template = crusoe_instance_template.test_template.id
    } 

    Adjust count as needed for your workload.

  3. Run terraform init and terraform apply and confirm resources are created successfully.

Example

terraform {
  required_providers {
    crusoe = {
      source  = "crusoecloud/crusoe"
      version = ">= 0.5.0"
    }
  }
}

locals {
  ssh_key = file("~/.ssh/id_ed25519.pub")
}

resource "crusoe_instance_template" "test_template" {
  name     = "test-template"
  type     = "c1a.2x"
  subnet   = "963fd792-3fc7-41ba-bec5-1e30d99de932"
  ssh_key  = local.ssh_key
  location = "eu-iceland1-a"
  image    = "ubuntu22.04:latest"
  disks = [{
    size = "128GiB"
    type = "persistent-ssd"
  }]
}

resource "crusoe_compute_instance_by_template" "test_instances" {
  count             = 2
  name_prefix       = "node-${count.index}"
  instance_template = crusoe_instance_template.test_template.id
}

Limitations

  • Instance Groups Not Supported: Attempts to use crusoe_compute_instance_group will fail with an authorisation error. This feature is targeted for general availability in Q3 2025 but is not yet customer-accessible.
  • Placement Policy (Spread): The placement_policy = "spread" field is visible in the API and Terraform, but its behaviour is inconsistent and not guaranteed. In some regions and configurations, specifying spread may distribute VMs across hosts, but this is not supported or documented for production use. If you require host-level isolation, contact Crusoe Support for manual scheduling.
  • Capacity Constraints: The number of VMs you can spread is limited by the number of available physical hosts for your chosen VM type. If you request more VMs with spread than there are available hosts, you will receive an "out of stock" error after creating as many as possible. Without spread, all VMs may be placed on any host if capacity allows.

Additional Resources

  1. https://docs.crusoecloud.com/compute/instance-templates/managing-templates
  2. https://docs.crusoecloud.com/api/#tag/Instance-Templates/operation/createInstanceTemplate 

Related to

Was this article helpful?

0 out of 0 found this helpful

Still need help?

Our support team is ready to assist you with any questions.

Have more questions? Submit a request

Recently Viewed

Comments

0 comments

Article is closed for comments.