Last Updated: March 23, 2026
Introduction
As OpenTofu matures as an open-source alternative to Terraform, maintaining a consistent workflow for high-performance cloud resources is vital. This guide shows how to configure OpenTofu to correctly load the Crusoe Cloud provider schema and provision a GPU-accelerated compute instance.
Note on Compatibility: OpenTofu is a drop-in replacement for Terraform. The Crusoe Cloud provider works identically across both tools. You can use the same
.tffiles and simply swap theterraformcommand fortofu.
Prerequisites
OpenTofu installed (v1.6.0+ recommended).
Crusoe Cloud Account: API credentials (access key and secret key).
SSH Key: A public key (e.g.,
~/.ssh/id_ed25519.pub) for VM access.Environment Variables: Credentials exported as
CRUSOE_API_KEYandCRUSOE_API_SECRET.
Step-by-Step Instructions
1. Initialize Provider Configuration
Create a main.tf file. OpenTofu automatically mirrors the Terraform Registry, so the source remains crusoecloud/crusoe.
terraform {
required_providers {
crusoe = {
source = "crusoecloud/crusoe"
}
}
}
provider "crusoe" {}2. Configure a Compute Instance
Define a crusoe_compute_instance resource. This example provisions an L40S GPU instance.
locals {
ssh_key = file("~/.ssh/id_ed25519.pub")
}
resource "crusoe_compute_instance" "my_vm" {
name = "opentofu-gpu-node"
type = "l40s-48gb.1x"
location = "us-southcentral1-a"
image = "ubuntu22.04:latest"
ssh_key = local.ssh_key
}3. Initialize and Deploy
Run the following commands to provision your infrastructure.
Initialize:
tofu init(Downloads the provider fromregistry.opentofu.org).Preview:
tofu plan(Validates the schema and shows the intended changes).Deploy:
tofu apply(Creates the instance on Crusoe Cloud).
Example
In this scenario, we use a data source to verify our environment before provisioning the VM.
Verification Block:
data "crusoe_ib_networks" "test" {}
output "provisioning_info" {
value = {
provider_source = "registry.opentofu.org/crusoecloud/crusoe"
available_networks = length(data.crusoe_ib_networks.test.ib_networks)
instance_name = crusoe_compute_instance.my_vm.name
}
}Expected Result (tofu plan):
data.crusoe_ib_networks.test: Reading...
data.crusoe_ib_networks.test: Read complete after 1s
Changes to Outputs:
+ provisioning_info = {
+ available_networks = 20
+ instance_name = "opentofu-gpu-node"
+ provider_source = "registry.opentofu.org/crusoecloud/crusoe"
}Troubleshooting
| Issue | Resolution |
|---|---|
| "Signature validation skipped" | This is a standard OpenTofu warning when a provider is installed from the registry without a stored GPG key. It does not affect functionality. |
| Authentication Error |
Ensure your ~/.crusoe/config file is formatted correctly or that your environment variables are active.
|
| Invalid Instance Type |
Crusoe types are specific (e.g., h100-80gb-sxm-ib.8x). Use the Crusoe CLI command crusoe compute vms types to verify available strings.
|