Skip to main content

Getting Started with Terraform

info

Crusoe Cloud is currently in private beta. If you do not currently have access, please request access to continue.

Installing and Configuring Terraform for Crusoe Cloud

This Quick Start Guide will walk you through the process of installing and configuring Terraform for use with Crusoe Cloud.

Step 1: Prerequisites

Ensure that your system meets the following prerequisites before proceeding:

  • Operating System: Compatible with Windows, macOS, or Linux.
  • Internet Connection: Required for downloading Terraform and related dependencies.
  • Crusoe Account: Ensure you have an active Crusoe account to access resources.

Step 2: Download Terraform

  1. Visit the official Terraform website
  2. Navigate to the "Downloads" section and choose the appropriate version for your operating system.
  3. Follow the installation instructions provided on the Terraform website to complete the installation.

Step 3: Verify Installation

  1. Open a terminal or command prompt.
  2. Run the following command to verify the successful installation:
terraform --version

This should display the installed Terraform version, confirming a successful installation.

Step 4: Authenticate with Crusoe

  1. Terraform looks for a config file at ~/.crusoe/config which contains credentials as well as any defaults.
  2. Please follow the steps to create API keys by heading to Managing API keys
  3. At a minimum, the following options are required to authenticate to the Crusoe API:
[default]
default_project="default"
access_key_id="<access_key_id>"
secret_key="<secret_key>"

Replace default_project with your actual project name, access_key_id and secret_key with your actual access key and secret key.

Step 5: Configure Terraform for Crusoe

  1. Open your terminal or command prompt.
  2. Navigate to the directory where you want to store your Terraform configurations.
  3. Create a new file named main.tf in the same directory and add the following to your Terraform configuration code.
// Crusoe Provider
terraform {
required_providers {
crusoe = {
source = "registry.terraform.io/crusoecloud/crusoe"
}
}
}
  1. Run the following command to initialize Terraform in the directory: terraform init

Conclusion

You have successfully installed and configured Terraform for use with Crusoe Cloud! Now, you can start creating resources. For example, visit Manage your VMS and click on the “Terraform” tab to create a VM. If you run into any issues, contact support.