1. Packages
  2. Iterative Provider
  3. API Docs
  4. Task
iterative 0.11.20 published on Monday, Apr 14, 2025 by iterative

iterative.Task

Explore with Pulumi AI

# Task Resource

This resource will:

  1. Create cloud resources (machines and storage) for the task.
  2. Upload the given storage.workdir to the cloud storage.
  3. Run the given script on the cloud machine until completion or timeout.
  4. Download results to the given storage.output.

Create Task Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Task(name: string, args: TaskArgs, opts?: CustomResourceOptions);
@overload
def Task(resource_name: str,
         args: TaskArgs,
         opts: Optional[ResourceOptions] = None)

@overload
def Task(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         cloud: Optional[str] = None,
         script: Optional[str] = None,
         region: Optional[str] = None,
         disk_size: Optional[float] = None,
         machine: Optional[str] = None,
         name: Optional[str] = None,
         parallelism: Optional[float] = None,
         permission_set: Optional[str] = None,
         environment: Optional[Mapping[str, str]] = None,
         image: Optional[str] = None,
         spot: Optional[float] = None,
         storages: Optional[Sequence[TaskStorageArgs]] = None,
         tags: Optional[Mapping[str, str]] = None,
         task_id: Optional[str] = None,
         timeout: Optional[float] = None,
         timeouts: Optional[TaskTimeoutsArgs] = None)
func NewTask(ctx *Context, name string, args TaskArgs, opts ...ResourceOption) (*Task, error)
public Task(string name, TaskArgs args, CustomResourceOptions? opts = null)
public Task(String name, TaskArgs args)
public Task(String name, TaskArgs args, CustomResourceOptions options)
type: iterative:Task
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. TaskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. TaskArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. TaskArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. TaskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. TaskArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var taskResource = new Iterative.Task("taskResource", new()
{
    Cloud = "string",
    Script = "string",
    Region = "string",
    DiskSize = 0,
    Machine = "string",
    Name = "string",
    Parallelism = 0,
    PermissionSet = "string",
    Environment = 
    {
        { "string", "string" },
    },
    Image = "string",
    Spot = 0,
    Storages = new[]
    {
        new Iterative.Inputs.TaskStorageArgs
        {
            Container = "string",
            ContainerOpts = 
            {
                { "string", "string" },
            },
            Excludes = new[]
            {
                "string",
            },
            Output = "string",
            Workdir = "string",
        },
    },
    Tags = 
    {
        { "string", "string" },
    },
    TaskId = "string",
    Timeout = 0,
    Timeouts = new Iterative.Inputs.TaskTimeoutsArgs
    {
        Create = "string",
        Delete = "string",
        Read = "string",
        Update = "string",
    },
});
Copy
example, err := iterative.NewTask(ctx, "taskResource", &iterative.TaskArgs{
Cloud: pulumi.String("string"),
Script: pulumi.String("string"),
Region: pulumi.String("string"),
DiskSize: pulumi.Float64(0),
Machine: pulumi.String("string"),
Name: pulumi.String("string"),
Parallelism: pulumi.Float64(0),
PermissionSet: pulumi.String("string"),
Environment: pulumi.StringMap{
"string": pulumi.String("string"),
},
Image: pulumi.String("string"),
Spot: pulumi.Float64(0),
Storages: .TaskStorageArray{
&.TaskStorageArgs{
Container: pulumi.String("string"),
ContainerOpts: pulumi.StringMap{
"string": pulumi.String("string"),
},
Excludes: pulumi.StringArray{
pulumi.String("string"),
},
Output: pulumi.String("string"),
Workdir: pulumi.String("string"),
},
},
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
TaskId: pulumi.String("string"),
Timeout: pulumi.Float64(0),
Timeouts: &.TaskTimeoutsArgs{
Create: pulumi.String("string"),
Delete: pulumi.String("string"),
Read: pulumi.String("string"),
Update: pulumi.String("string"),
},
})
Copy
var taskResource = new Task("taskResource", TaskArgs.builder()
    .cloud("string")
    .script("string")
    .region("string")
    .diskSize(0)
    .machine("string")
    .name("string")
    .parallelism(0)
    .permissionSet("string")
    .environment(Map.of("string", "string"))
    .image("string")
    .spot(0)
    .storages(TaskStorageArgs.builder()
        .container("string")
        .containerOpts(Map.of("string", "string"))
        .excludes("string")
        .output("string")
        .workdir("string")
        .build())
    .tags(Map.of("string", "string"))
    .taskId("string")
    .timeout(0)
    .timeouts(TaskTimeoutsArgs.builder()
        .create("string")
        .delete("string")
        .read("string")
        .update("string")
        .build())
    .build());
Copy
task_resource = iterative.Task("taskResource",
    cloud="string",
    script="string",
    region="string",
    disk_size=0,
    machine="string",
    name="string",
    parallelism=0,
    permission_set="string",
    environment={
        "string": "string",
    },
    image="string",
    spot=0,
    storages=[{
        "container": "string",
        "container_opts": {
            "string": "string",
        },
        "excludes": ["string"],
        "output": "string",
        "workdir": "string",
    }],
    tags={
        "string": "string",
    },
    task_id="string",
    timeout=0,
    timeouts={
        "create": "string",
        "delete": "string",
        "read": "string",
        "update": "string",
    })
Copy
const taskResource = new iterative.Task("taskResource", {
    cloud: "string",
    script: "string",
    region: "string",
    diskSize: 0,
    machine: "string",
    name: "string",
    parallelism: 0,
    permissionSet: "string",
    environment: {
        string: "string",
    },
    image: "string",
    spot: 0,
    storages: [{
        container: "string",
        containerOpts: {
            string: "string",
        },
        excludes: ["string"],
        output: "string",
        workdir: "string",
    }],
    tags: {
        string: "string",
    },
    taskId: "string",
    timeout: 0,
    timeouts: {
        create: "string",
        "delete": "string",
        read: "string",
        update: "string",
    },
});
Copy
type: iterative:Task
properties:
    cloud: string
    diskSize: 0
    environment:
        string: string
    image: string
    machine: string
    name: string
    parallelism: 0
    permissionSet: string
    region: string
    script: string
    spot: 0
    storages:
        - container: string
          containerOpts:
            string: string
          excludes:
            - string
          output: string
          workdir: string
    tags:
        string: string
    taskId: string
    timeout: 0
    timeouts:
        create: string
        delete: string
        read: string
        update: string
Copy

Task Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Task resource accepts the following input properties:

Cloud This property is required. string
Script This property is required. string
DiskSize double
Environment Dictionary<string, string>
Image string
Machine string
Name string
Parallelism double
PermissionSet string
Region string
Spot double
Storages List<TaskStorage>
Tags Dictionary<string, string>
TaskId string
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
Timeout double
Timeouts TaskTimeouts
Cloud This property is required. string
Script This property is required. string
DiskSize float64
Environment map[string]string
Image string
Machine string
Name string
Parallelism float64
PermissionSet string
Region string
Spot float64
Storages []TaskStorageArgs
Tags map[string]string
TaskId string
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
Timeout float64
Timeouts TaskTimeoutsArgs
cloud This property is required. String
script This property is required. String
diskSize Double
environment Map<String,String>
image String
machine String
name String
parallelism Double
permissionSet String
region String
spot Double
storages List<TaskStorage>
tags Map<String,String>
taskId String
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout Double
timeouts TaskTimeouts
cloud This property is required. string
script This property is required. string
diskSize number
environment {[key: string]: string}
image string
machine string
name string
parallelism number
permissionSet string
region string
spot number
storages TaskStorage[]
tags {[key: string]: string}
taskId string
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout number
timeouts TaskTimeouts
cloud This property is required. str
script This property is required. str
disk_size float
environment Mapping[str, str]
image str
machine str
name str
parallelism float
permission_set str
region str
spot float
storages Sequence[TaskStorageArgs]
tags Mapping[str, str]
task_id str
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout float
timeouts TaskTimeoutsArgs
cloud This property is required. String
script This property is required. String
diskSize Number
environment Map<String>
image String
machine String
name String
parallelism Number
permissionSet String
region String
spot Number
storages List<Property Map>
tags Map<String>
taskId String
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout Number
timeouts Property Map

Outputs

All input properties are implicitly available as output properties. Additionally, the Task resource produces the following output properties:

Addresses List<string>
IP addresses of the currently active machines.
Events List<string>
List of events for the machine orchestrator.
Id string
The provider-assigned unique ID for this managed resource.
Logs List<string>
List with task logs; one for each machine.
SshPrivateKey string
Used to access the created machines.
SshPublicKey string
Used to access the created machines.
Status Dictionary<string, double>
Status of the machine orchestrator.
Addresses []string
IP addresses of the currently active machines.
Events []string
List of events for the machine orchestrator.
Id string
The provider-assigned unique ID for this managed resource.
Logs []string
List with task logs; one for each machine.
SshPrivateKey string
Used to access the created machines.
SshPublicKey string
Used to access the created machines.
Status map[string]float64
Status of the machine orchestrator.
addresses List<String>
IP addresses of the currently active machines.
events List<String>
List of events for the machine orchestrator.
id String
The provider-assigned unique ID for this managed resource.
logs List<String>
List with task logs; one for each machine.
sshPrivateKey String
Used to access the created machines.
sshPublicKey String
Used to access the created machines.
status Map<String,Double>
Status of the machine orchestrator.
addresses string[]
IP addresses of the currently active machines.
events string[]
List of events for the machine orchestrator.
id string
The provider-assigned unique ID for this managed resource.
logs string[]
List with task logs; one for each machine.
sshPrivateKey string
Used to access the created machines.
sshPublicKey string
Used to access the created machines.
status {[key: string]: number}
Status of the machine orchestrator.
addresses Sequence[str]
IP addresses of the currently active machines.
events Sequence[str]
List of events for the machine orchestrator.
id str
The provider-assigned unique ID for this managed resource.
logs Sequence[str]
List with task logs; one for each machine.
ssh_private_key str
Used to access the created machines.
ssh_public_key str
Used to access the created machines.
status Mapping[str, float]
Status of the machine orchestrator.
addresses List<String>
IP addresses of the currently active machines.
events List<String>
List of events for the machine orchestrator.
id String
The provider-assigned unique ID for this managed resource.
logs List<String>
List with task logs; one for each machine.
sshPrivateKey String
Used to access the created machines.
sshPublicKey String
Used to access the created machines.
status Map<Number>
Status of the machine orchestrator.

Look up Existing Task Resource

Get an existing Task resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: TaskState, opts?: CustomResourceOptions): Task
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        addresses: Optional[Sequence[str]] = None,
        cloud: Optional[str] = None,
        disk_size: Optional[float] = None,
        environment: Optional[Mapping[str, str]] = None,
        events: Optional[Sequence[str]] = None,
        image: Optional[str] = None,
        logs: Optional[Sequence[str]] = None,
        machine: Optional[str] = None,
        name: Optional[str] = None,
        parallelism: Optional[float] = None,
        permission_set: Optional[str] = None,
        region: Optional[str] = None,
        script: Optional[str] = None,
        spot: Optional[float] = None,
        ssh_private_key: Optional[str] = None,
        ssh_public_key: Optional[str] = None,
        status: Optional[Mapping[str, float]] = None,
        storages: Optional[Sequence[TaskStorageArgs]] = None,
        tags: Optional[Mapping[str, str]] = None,
        task_id: Optional[str] = None,
        timeout: Optional[float] = None,
        timeouts: Optional[TaskTimeoutsArgs] = None) -> Task
func GetTask(ctx *Context, name string, id IDInput, state *TaskState, opts ...ResourceOption) (*Task, error)
public static Task Get(string name, Input<string> id, TaskState? state, CustomResourceOptions? opts = null)
public static Task get(String name, Output<String> id, TaskState state, CustomResourceOptions options)
resources:  _:    type: iterative:Task    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Addresses List<string>
IP addresses of the currently active machines.
Cloud string
DiskSize double
Environment Dictionary<string, string>
Events List<string>
List of events for the machine orchestrator.
Image string
Logs List<string>
List with task logs; one for each machine.
Machine string
Name string
Parallelism double
PermissionSet string
Region string
Script string
Spot double
SshPrivateKey string
Used to access the created machines.
SshPublicKey string
Used to access the created machines.
Status Dictionary<string, double>
Status of the machine orchestrator.
Storages List<TaskStorage>
Tags Dictionary<string, string>
TaskId string
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
Timeout double
Timeouts TaskTimeouts
Addresses []string
IP addresses of the currently active machines.
Cloud string
DiskSize float64
Environment map[string]string
Events []string
List of events for the machine orchestrator.
Image string
Logs []string
List with task logs; one for each machine.
Machine string
Name string
Parallelism float64
PermissionSet string
Region string
Script string
Spot float64
SshPrivateKey string
Used to access the created machines.
SshPublicKey string
Used to access the created machines.
Status map[string]float64
Status of the machine orchestrator.
Storages []TaskStorageArgs
Tags map[string]string
TaskId string
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
Timeout float64
Timeouts TaskTimeoutsArgs
addresses List<String>
IP addresses of the currently active machines.
cloud String
diskSize Double
environment Map<String,String>
events List<String>
List of events for the machine orchestrator.
image String
logs List<String>
List with task logs; one for each machine.
machine String
name String
parallelism Double
permissionSet String
region String
script String
spot Double
sshPrivateKey String
Used to access the created machines.
sshPublicKey String
Used to access the created machines.
status Map<String,Double>
Status of the machine orchestrator.
storages List<TaskStorage>
tags Map<String,String>
taskId String
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout Double
timeouts TaskTimeouts
addresses string[]
IP addresses of the currently active machines.
cloud string
diskSize number
environment {[key: string]: string}
events string[]
List of events for the machine orchestrator.
image string
logs string[]
List with task logs; one for each machine.
machine string
name string
parallelism number
permissionSet string
region string
script string
spot number
sshPrivateKey string
Used to access the created machines.
sshPublicKey string
Used to access the created machines.
status {[key: string]: number}
Status of the machine orchestrator.
storages TaskStorage[]
tags {[key: string]: string}
taskId string
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout number
timeouts TaskTimeouts
addresses Sequence[str]
IP addresses of the currently active machines.
cloud str
disk_size float
environment Mapping[str, str]
events Sequence[str]
List of events for the machine orchestrator.
image str
logs Sequence[str]
List with task logs; one for each machine.
machine str
name str
parallelism float
permission_set str
region str
script str
spot float
ssh_private_key str
Used to access the created machines.
ssh_public_key str
Used to access the created machines.
status Mapping[str, float]
Status of the machine orchestrator.
storages Sequence[TaskStorageArgs]
tags Mapping[str, str]
task_id str
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout float
timeouts TaskTimeoutsArgs
addresses List<String>
IP addresses of the currently active machines.
cloud String
diskSize Number
environment Map<String>
events List<String>
List of events for the machine orchestrator.
image String
logs List<String>
List with task logs; one for each machine.
machine String
name String
parallelism Number
permissionSet String
region String
script String
spot Number
sshPrivateKey String
Used to access the created machines.
sshPublicKey String
Used to access the created machines.
status Map<Number>
Status of the machine orchestrator.
storages List<Property Map>
tags Map<String>
taskId String
Task identifier, tpi-{name}-{random_hash_1}-{random_hash_2}. Either the full {id} or (if too long), the shorter {random_hash_1}{random_hash_2} is used as the name for all cloud resources.
timeout Number
timeouts Property Map

Supporting Types

TaskStorage
, TaskStorageArgs

Container string
ContainerOpts Dictionary<string, string>
Excludes List<string>
Output string
Workdir string
Container string
ContainerOpts map[string]string
Excludes []string
Output string
Workdir string
container String
containerOpts Map<String,String>
excludes List<String>
output String
workdir String
container string
containerOpts {[key: string]: string}
excludes string[]
output string
workdir string
container str
container_opts Mapping[str, str]
excludes Sequence[str]
output str
workdir str
container String
containerOpts Map<String>
excludes List<String>
output String
workdir String

TaskTimeouts
, TaskTimeoutsArgs

Create string
Delete string
Read string
Update string
Create string
Delete string
Read string
Update string
create String
delete String
read String
update String
create string
delete string
read string
update string
create str
delete str
read str
update str
create String
delete String
read String
update String

Package Details

Repository
iterative iterative/terraform-provider-iterative
License
Notes
This Pulumi package is based on the iterative Terraform Provider.