Problem
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
- Make sure you have terraform installed.
- Install Crusoe CLI to authenticate.
Steps
- 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" }] }
-
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. - Run
terraform init
andterraform 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, specifyingspread
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.
Comments
0 comments
Please sign in to leave a comment.