Official Terraform provider for RunPod - manage GPU cloud infrastructure as code.
- Pod Management: Create, read, and delete GPU/CPU pods with flexible configuration
- Network Volumes: Manage persistent storage volumes across pods
- Serverless Endpoints: Deploy and manage serverless GPU endpoints
- Data Sources: Query existing resources including pods, volumes, endpoints, and templates
runpod_pod- Manage GPU/CPU podsrunpod_network_volume- Manage persistent network storagerunpod_endpoint- Manage serverless endpoints
runpod_pods- List all podsrunpod_network_volumes- List all network volumesrunpod_endpoints- List all serverless endpointsrunpod_templates- List available templates
-
Set your API key:
export RUNPOD_API_KEY="your-api-key-here"
-
Create a basic configuration:
terraform { required_providers { runpod = { source = "decentralized-infrastructure/runpod" } } } provider "runpod" { # API key from environment variable RUNPOD_API_KEY } # Create a GPU pod resource "runpod_pod" "example" { name = "my-gpu-pod" image_name = "runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel" gpu_type_ids = ["NVIDIA GeForce RTX 4090", "NVIDIA A40"] data_center_ids = ["US-CA-2", "US-TX-3"] gpu_count = 1 cloud_type = "COMMUNITY" support_public_ip = true volume_in_gb = 20 container_disk_in_gb = 20 ports = ["8888/http", "22/tcp"] }
-
Deploy:
terraform init terraform plan terraform apply
See the examples/ directory for comprehensive usage examples.
- Clone the repository
- Enter the repository directory
- Build the provider:
go build -o terraform-provider-runpodThis provider uses Go modules.
To add a new dependency:
go get github.com/author/dependency
go mod tidyIf you wish to work on the provider, you'll first need Go installed on your machine.
To compile the provider, run go build. This will build the provider and put the provider binary in the current directory.
For development testing, you can use a .terraformrc file to override the provider location:
provider_installation {
dev_overrides {
"registry.terraform.io/decentralized-infrastructure/runpod" = "/path/to/your/go/bin"
}
direct {}
}In order to generate documentation for the provider, the following command can be run:
go get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
tfplugindocs generate
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.