Getting Started with Terraform
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
- Visit the official Terraform website
- Navigate to the "Downloads" section and choose the appropriate version for your operating system.
- Follow the installation instructions provided on the Terraform website to complete the installation.
Step 3: Verify Installation
- Open a terminal or command prompt.
- 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
- Terraform looks for a config file at
~/.crusoe/config
which contains credentials as well as any defaults. - Please follow the steps to create API keys by heading to Managing API keys
- 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
- Open your terminal or command prompt.
- Navigate to the directory where you want to store your Terraform configurations.
- 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"
}
}
}
- 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.