terradev-dagger
Terradev Dagger module.
Installation
dagger install github.com/theoddden/terradev-dagger@v0.1.0Entrypoint
Return Type
TerradevDagger ! Example
dagger -m github.com/theoddden/terradev-dagger@9ff4c9a58cc2cf41f8801b848d2cbc968cba78da call \
func (m *MyModule) Example() *dagger.TerradevDagger {
return dag.
Terradevdagger()
}@function
def example() -> dagger.TerradevDagger:
return (
dag.terradev_dagger()
)@func()
example(): TerradevDagger {
return dag
.terradevDagger()
}Types
TerradevDagger 🔗
Add Terradev GPU provisioning to any Dagger pipeline.
All functions run the Terradev CLI inside a python:3.11-slim
container. Cloud provider API keys are accepted as Dagger Secrets, so
they are never written to Dagger’s infrastructure or to disk in plain
text.
providers() 🔗
List all 17 verified Terradev providers.
No API key is required. Returns provider metadata including egress pricing and spot support.
Return Type
String ! Example
dagger -m github.com/theoddden/terradev-dagger@9ff4c9a58cc2cf41f8801b848d2cbc968cba78da call \
providersfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Terradevdagger().
Providers(ctx)
}@function
async def example() -> str:
return await (
dag.terradev_dagger()
.providers()
)@func()
async example(): Promise<string> {
return dag
.terradevDagger()
.providers()
}provision() 🔗
- Provision a GPU instance and return its instance ID.
- :param provider: Cloud provider to use (e.g.
runpod,vastai). :param gpu_type: GPU type to provision (e.g.A100,H100). :param api_key: Provider API key passed as a Dagger Secret.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| provider | String ! | - | No description provided |
| gpuType | String ! | - | No description provided |
| apiKey | Secret ! | - | A reference to a secret value, which can be handled more safely than the value itself. |
Example
dagger -m github.com/theoddden/terradev-dagger@9ff4c9a58cc2cf41f8801b848d2cbc968cba78da call \
provision --provider string --gpu-type string --api-key env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, provider string, gpuType string, apiKey *dagger.Secret) string {
return dag.
Terradevdagger().
Provision(ctx, provider, gpuType, apiKey)
}@function
async def example(provider: str, gputype: str, apikey: dagger.Secret) -> str:
return await (
dag.terradev_dagger()
.provision(provider, gputype, apikey)
)@func()
async example(provider: string, gpuType: string, apiKey: Secret): Promise<string> {
return dag
.terradevDagger()
.provision(provider, gpuType, apiKey)
}run() 🔗
- Provision a GPU, run a command, and tear it down automatically.
- :param provider: Cloud provider to use. :param gpu_type: GPU type to provision. :param api_key: Provider API key as a Dagger Secret. :param command: Shell command to execute on the provisioned GPU.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| provider | String ! | - | No description provided |
| gpuType | String ! | - | No description provided |
| apiKey | Secret ! | - | A reference to a secret value, which can be handled more safely than the value itself. |
| command | String ! | - | No description provided |
Example
dagger -m github.com/theoddden/terradev-dagger@9ff4c9a58cc2cf41f8801b848d2cbc968cba78da call \
run --provider string --gpu-type string --api-key env:MYSECRET --command stringfunc (m *MyModule) Example(ctx context.Context, provider string, gpuType string, apiKey *dagger.Secret, command string) string {
return dag.
Terradevdagger().
Run(ctx, provider, gpuType, apiKey, command)
}@function
async def example(provider: str, gputype: str, apikey: dagger.Secret, command: str) -> str:
return await (
dag.terradev_dagger()
.run(provider, gputype, apikey, command)
)@func()
async example(provider: string, gpuType: string, apiKey: Secret, command: string): Promise<string> {
return dag
.terradevDagger()
.run(provider, gpuType, apiKey, command)
}teardown() 🔗
- Tear down a provisioned GPU instance.
- :param instance_id: ID of the instance to terminate. :param provider: Cloud provider the instance belongs to. :param api_key: Provider API key as a Dagger Secret.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| instanceId | String ! | - | No description provided |
| provider | String ! | - | No description provided |
| apiKey | Secret ! | - | A reference to a secret value, which can be handled more safely than the value itself. |
Example
dagger -m github.com/theoddden/terradev-dagger@9ff4c9a58cc2cf41f8801b848d2cbc968cba78da call \
teardown --instance-id string --provider string --api-key env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, instanceId string, provider string, apiKey *dagger.Secret) string {
return dag.
Terradevdagger().
Teardown(ctx, instanceId, provider, apiKey)
}@function
async def example(instanceid: str, provider: str, apikey: dagger.Secret) -> str:
return await (
dag.terradev_dagger()
.teardown(instanceid, provider, apikey)
)@func()
async example(instanceId: string, provider: string, apiKey: Secret): Promise<string> {
return dag
.terradevDagger()
.teardown(instanceId, provider, apiKey)
}