A Terraform provider for managing RunPod infrastructure using the Terraform Plugin Framework.
- Go 1.21 or higher
- Terraform 1.0 or higher
- RunPod API token
go build -o terraform-provider-runpodCreate ~/.terraform.rc:
provider_installation {
filesystem_paths {
paths = ["."]
}
}Or use environment variable:
export TF_CLI_CONFIG_FILE=~/.terraform.rcterraform {
required_providers {
runpod = {
source = "runpod/runpod"
}
}
}
# API key can be set via environment variable RUNPOD_API_KEY
# or in the provider configuration (not shown in this example)
resource "runpod_pod" "demo" {
machine_id = "your-machine-id"
image_name = "runpod/miniconda:py3.10-cuda11.8.0"
gpu_count = 1
start_ssh = true
}Set your RunPod API key as an environment variable:
export RUNPOD_API_KEY="your-api-key-here"Get your API key from RunPod Console
examples/basic/- Basic pod creationexamples/actions/- Pod actionsexamples/datasources/- Data sourcesexamples/machine/- Machine managementexamples/monitoring/- Pod monitoring
tfplugingen-framework generate all \
--input terraform-provider-spec.json \
--output internal/providerterraform-provider/
├── internal/provider/ # Generated code
│ ├── provider_runpod/
│ ├── resource_pod/
│ ├── resource_pod_action/
│ ├── resource_machine/
│ ├── datasource_pod/
│ ├── datasource_machine/
│ └── ...
├── examples/ # Example configurations
├── main.go # Provider entry point
├── plugin.go # Plugin interface
├── go.mod # Go dependencies
└── terraform-provider-spec.json # Provider specification
The provider specification is defined in terraform-provider-spec.json and includes:
runpod_pod- Pod managementrunpod_pod_action- Pod actionsrunpod_machine- Machine management
runpod_pod- Pod informationrunpod_machine- Machine informationrunpod_machines- Machine listingrunpod_gpu_types- GPU typesrunpod_data_centers- Data centersrunpod_user- User info
MIT