Skip to main content
Crusoe Support Help Center home page
Crusoe

How-To Manage Multiple Projects in Terraform with Crusoe Cloud

Rishabh Sinha
Rishabh Sinha
Updated

Last Updated: Jan 09, 2026

Introduction

This article explains how to deploy resources, such as virtual machines (VMs), across multiple projects in Crusoe Cloud using Terraform. It addresses a common requirement for users managing infrastructure across different crusoe projects.

Prerequisites


Step-by-Step Instructions

  1. Check the list of available projects and types of vms available
    • Run the command below to list available projects and their project IDs. Select the project_ids where you want to deploy your resources.

      crusoe projects list
    • The command below lists all the available locations, where your resources will be deployed.

      crusoe locations list
    • The command below lists all the available images.

      crusoe compute images list
    • The command below lists all the available VM types to choose from.

      crusoe compute vms types 
  2. Create Terraform file to provision the vms in different projects
    • Create a file named `main.tf` and copy the following configuration and update the values as per your requirements:

      terraform {
          required_providers {
            crusoe = {
              source = "crusoecloud/crusoe"
                version = "0.5.26"
          }
        }
      }
      
      locals {
         ssh_key = file("~/.ssh/id_ed25519.pub") #replace with path to your public SSH key if different
      
      variable "project_id1" {
         type = string
         default = "YOUR_PROJECT1_ID" #add your project1 id here
      }
      
      variable "project_id2" {
         type = string
         default = "YOUR_PROJECT2_ID" #add your project2 id here
      }
      
      #creating VM1 in project_id1
      resource "crusoe_compute_instance" "vmprojectid1" {
         name = "testproject1vm"
         project_id = var.project_id1
         type = "c1a.2x"
         location = "eu-iceland1-a"
         image = "ubuntu22.04:latest"
         ssh_key = local.ssh_key
      }
      
      #creating VM2 in project_id2
      resource "crusoe_compute_instance" "vmprojectid2" {
         name = "testproject2vm"
         project_id = var.project_id2
         type = "c1a.2x"
         location = "eu-iceland1-a"
         image = "ubuntu22.04:latest"
         ssh_key = local.ssh_key
      }
    • At the root of your terraform project, run the series of commands below to deploy the resources to multiple projects.

      terraform init
      terraform plan
      terraform apply
    • Terraform will provision the VMs in both projects.

Additional Resources

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.