An official Terraform provider for managing RunPod GPU cloud resources.
terraform {
required_providers {
runpod = {
source = "runpod/runpod"
version = "~> 0.1.0"
}
}
}terraform {
required_providers {
runpod = {
source = "hashicorp/runpod"
version = "0.1.0"
}
}
}provider "runpod" {
api_key = var.runpod_api_key
endpoint = "https://api.runpod.io/graphql" # Optional, defaults to prod
}Deploy and manage RunPod pods (compute instances).
resource "runpod_pod" "example" {
name = "my-pod"
pod_template_id = "template-id"
container_disk_size_gb = 10
min_memory = 8
min_gpu = 1
gpu_types = "RTX,A100"
cloud_type = "ALL"
wait_for_gpu = true
env = jsonencode({
ENVIRONMENT = "production"
})
port = "8080:8080"
command = "python app.py"
}Create and manage dedicated GPU machines.
resource "runpod_machine" "example" {
name = "training-machine"
description = "Dedicated machine for ML"
gpu_count = 4
gpu_type = "A100"
cpu_count = 32
memory_gb = 256
disk_gb = 1000
region = "US_EAST"
}Perform actions on pods (stop/resume/restart/terminate).
resource "runpod_pod_action" "example" {
pod_id = runpod_pod.example.id
action = "stop" # stop, resume, restart, terminate
}List available GPU types.
data "runpod_gpu_types" "available" {}List data centers.
data "runpod_data_centers" "available" {}Get single machine by ID.
data "runpod_machine" "example" {
machine_id = "machine-id"
}List all machines.
data "runpod_machines" "available" {}Get single pod by ID.
data "runpod_pod" "example" {
pod_id = "pod-id"
}Get current user info.
data "runpod_user" "current" {}The provider uses API key authentication. Get your API key from the RunPod console at https://www.runpod.io/console/user/settings.
# Build the provider
go build -o terraform-provider-runpod
# Test
go test ./...Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.