1. Packages
  2. Scaleway
  3. API Docs
  4. JobDefinition
Scaleway v1.26.0 published on Friday, Mar 28, 2025 by pulumiverse

scaleway.JobDefinition

Explore with Pulumi AI

Deprecated: scaleway.index/jobdefinition.JobDefinition has been deprecated in favor of scaleway.job/definition.Definition

Creates and manages a Scaleway Serverless Job Definition. For more information, see the Go API documentation.

Example Usage

Basic

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";

const main = new scaleway.job.Definition("main", {
    name: "testjob",
    cpuLimit: 140,
    memoryLimit: 256,
    imageUri: "docker.io/alpine:latest",
    command: "ls",
    timeout: "10m",
    env: {
        foo: "bar",
    },
    cron: {
        schedule: "5 4 1 * *",
        timezone: "Europe/Paris",
    },
});
Copy
import pulumi
import pulumiverse_scaleway as scaleway

main = scaleway.job.Definition("main",
    name="testjob",
    cpu_limit=140,
    memory_limit=256,
    image_uri="docker.io/alpine:latest",
    command="ls",
    timeout="10m",
    env={
        "foo": "bar",
    },
    cron={
        "schedule": "5 4 1 * *",
        "timezone": "Europe/Paris",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/job"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := job.NewDefinition(ctx, "main", &job.DefinitionArgs{
			Name:        pulumi.String("testjob"),
			CpuLimit:    pulumi.Int(140),
			MemoryLimit: pulumi.Int(256),
			ImageUri:    pulumi.String("docker.io/alpine:latest"),
			Command:     pulumi.String("ls"),
			Timeout:     pulumi.String("10m"),
			Env: pulumi.StringMap{
				"foo": pulumi.String("bar"),
			},
			Cron: &job.DefinitionCronArgs{
				Schedule: pulumi.String("5 4 1 * *"),
				Timezone: pulumi.String("Europe/Paris"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;

return await Deployment.RunAsync(() => 
{
    var main = new Scaleway.Job.Definition("main", new()
    {
        Name = "testjob",
        CpuLimit = 140,
        MemoryLimit = 256,
        ImageUri = "docker.io/alpine:latest",
        Command = "ls",
        Timeout = "10m",
        Env = 
        {
            { "foo", "bar" },
        },
        Cron = new Scaleway.Job.Inputs.DefinitionCronArgs
        {
            Schedule = "5 4 1 * *",
            Timezone = "Europe/Paris",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.job.Definition;
import com.pulumi.scaleway.job.DefinitionArgs;
import com.pulumi.scaleway.job.inputs.DefinitionCronArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var main = new Definition("main", DefinitionArgs.builder()
            .name("testjob")
            .cpuLimit(140)
            .memoryLimit(256)
            .imageUri("docker.io/alpine:latest")
            .command("ls")
            .timeout("10m")
            .env(Map.of("foo", "bar"))
            .cron(DefinitionCronArgs.builder()
                .schedule("5 4 1 * *")
                .timezone("Europe/Paris")
                .build())
            .build());

    }
}
Copy
resources:
  main:
    type: scaleway:job:Definition
    properties:
      name: testjob
      cpuLimit: 140
      memoryLimit: 256
      imageUri: docker.io/alpine:latest
      command: ls
      timeout: 10m
      env:
        foo: bar
      cron:
        schedule: 5 4 1 * *
        timezone: Europe/Paris
Copy

Create JobDefinition Resource

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

Constructor syntax

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

@overload
def JobDefinition(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  command: Optional[str] = None,
                  cpu_limit: Optional[int] = None,
                  cron: Optional[JobDefinitionCronArgs] = None,
                  description: Optional[str] = None,
                  env: Optional[Mapping[str, str]] = None,
                  image_uri: Optional[str] = None,
                  memory_limit: Optional[int] = None,
                  name: Optional[str] = None,
                  project_id: Optional[str] = None,
                  region: Optional[str] = None,
                  timeout: Optional[str] = None)
func NewJobDefinition(ctx *Context, name string, args JobDefinitionArgs, opts ...ResourceOption) (*JobDefinition, error)
public JobDefinition(string name, JobDefinitionArgs args, CustomResourceOptions? opts = null)
public JobDefinition(String name, JobDefinitionArgs args)
public JobDefinition(String name, JobDefinitionArgs args, CustomResourceOptions options)
type: scaleway:JobDefinition
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. JobDefinitionArgs
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. JobDefinitionArgs
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. JobDefinitionArgs
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. JobDefinitionArgs
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. JobDefinitionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

JobDefinition 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 JobDefinition resource accepts the following input properties:

CpuLimit This property is required. int
The amount of vCPU computing resources to allocate to each container running the job.
MemoryLimit This property is required. int
The memory computing resources in MB to allocate to each container running the job.
Command string
The command that will be run in the container if specified.
Cron Pulumiverse.Scaleway.Inputs.JobDefinitionCron
The cron configuration
Description string
The description of the job
Env Dictionary<string, string>
The environment variables of the container.
ImageUri string
The uri of the container image that will be used for the job run.
Name string
The name of the job.
ProjectId Changes to this property will trigger replacement. string
project_id) The ID of the project the Job is associated with.
Region Changes to this property will trigger replacement. string
region) The region of the Job.
Timeout string
The job run timeout, in Go Time format (ex: 2h30m25s)
CpuLimit This property is required. int
The amount of vCPU computing resources to allocate to each container running the job.
MemoryLimit This property is required. int
The memory computing resources in MB to allocate to each container running the job.
Command string
The command that will be run in the container if specified.
Cron JobDefinitionCronArgs
The cron configuration
Description string
The description of the job
Env map[string]string
The environment variables of the container.
ImageUri string
The uri of the container image that will be used for the job run.
Name string
The name of the job.
ProjectId Changes to this property will trigger replacement. string
project_id) The ID of the project the Job is associated with.
Region Changes to this property will trigger replacement. string
region) The region of the Job.
Timeout string
The job run timeout, in Go Time format (ex: 2h30m25s)
cpuLimit This property is required. Integer
The amount of vCPU computing resources to allocate to each container running the job.
memoryLimit This property is required. Integer
The memory computing resources in MB to allocate to each container running the job.
command String
The command that will be run in the container if specified.
cron JobDefinitionCron
The cron configuration
description String
The description of the job
env Map<String,String>
The environment variables of the container.
imageUri String
The uri of the container image that will be used for the job run.
name String
The name of the job.
projectId Changes to this property will trigger replacement. String
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. String
region) The region of the Job.
timeout String
The job run timeout, in Go Time format (ex: 2h30m25s)
cpuLimit This property is required. number
The amount of vCPU computing resources to allocate to each container running the job.
memoryLimit This property is required. number
The memory computing resources in MB to allocate to each container running the job.
command string
The command that will be run in the container if specified.
cron JobDefinitionCron
The cron configuration
description string
The description of the job
env {[key: string]: string}
The environment variables of the container.
imageUri string
The uri of the container image that will be used for the job run.
name string
The name of the job.
projectId Changes to this property will trigger replacement. string
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. string
region) The region of the Job.
timeout string
The job run timeout, in Go Time format (ex: 2h30m25s)
cpu_limit This property is required. int
The amount of vCPU computing resources to allocate to each container running the job.
memory_limit This property is required. int
The memory computing resources in MB to allocate to each container running the job.
command str
The command that will be run in the container if specified.
cron JobDefinitionCronArgs
The cron configuration
description str
The description of the job
env Mapping[str, str]
The environment variables of the container.
image_uri str
The uri of the container image that will be used for the job run.
name str
The name of the job.
project_id Changes to this property will trigger replacement. str
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. str
region) The region of the Job.
timeout str
The job run timeout, in Go Time format (ex: 2h30m25s)
cpuLimit This property is required. Number
The amount of vCPU computing resources to allocate to each container running the job.
memoryLimit This property is required. Number
The memory computing resources in MB to allocate to each container running the job.
command String
The command that will be run in the container if specified.
cron Property Map
The cron configuration
description String
The description of the job
env Map<String>
The environment variables of the container.
imageUri String
The uri of the container image that will be used for the job run.
name String
The name of the job.
projectId Changes to this property will trigger replacement. String
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. String
region) The region of the Job.
timeout String
The job run timeout, in Go Time format (ex: 2h30m25s)

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing JobDefinition Resource

Get an existing JobDefinition 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?: JobDefinitionState, opts?: CustomResourceOptions): JobDefinition
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        command: Optional[str] = None,
        cpu_limit: Optional[int] = None,
        cron: Optional[JobDefinitionCronArgs] = None,
        description: Optional[str] = None,
        env: Optional[Mapping[str, str]] = None,
        image_uri: Optional[str] = None,
        memory_limit: Optional[int] = None,
        name: Optional[str] = None,
        project_id: Optional[str] = None,
        region: Optional[str] = None,
        timeout: Optional[str] = None) -> JobDefinition
func GetJobDefinition(ctx *Context, name string, id IDInput, state *JobDefinitionState, opts ...ResourceOption) (*JobDefinition, error)
public static JobDefinition Get(string name, Input<string> id, JobDefinitionState? state, CustomResourceOptions? opts = null)
public static JobDefinition get(String name, Output<String> id, JobDefinitionState state, CustomResourceOptions options)
resources:  _:    type: scaleway:JobDefinition    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:
Command string
The command that will be run in the container if specified.
CpuLimit int
The amount of vCPU computing resources to allocate to each container running the job.
Cron Pulumiverse.Scaleway.Inputs.JobDefinitionCron
The cron configuration
Description string
The description of the job
Env Dictionary<string, string>
The environment variables of the container.
ImageUri string
The uri of the container image that will be used for the job run.
MemoryLimit int
The memory computing resources in MB to allocate to each container running the job.
Name string
The name of the job.
ProjectId Changes to this property will trigger replacement. string
project_id) The ID of the project the Job is associated with.
Region Changes to this property will trigger replacement. string
region) The region of the Job.
Timeout string
The job run timeout, in Go Time format (ex: 2h30m25s)
Command string
The command that will be run in the container if specified.
CpuLimit int
The amount of vCPU computing resources to allocate to each container running the job.
Cron JobDefinitionCronArgs
The cron configuration
Description string
The description of the job
Env map[string]string
The environment variables of the container.
ImageUri string
The uri of the container image that will be used for the job run.
MemoryLimit int
The memory computing resources in MB to allocate to each container running the job.
Name string
The name of the job.
ProjectId Changes to this property will trigger replacement. string
project_id) The ID of the project the Job is associated with.
Region Changes to this property will trigger replacement. string
region) The region of the Job.
Timeout string
The job run timeout, in Go Time format (ex: 2h30m25s)
command String
The command that will be run in the container if specified.
cpuLimit Integer
The amount of vCPU computing resources to allocate to each container running the job.
cron JobDefinitionCron
The cron configuration
description String
The description of the job
env Map<String,String>
The environment variables of the container.
imageUri String
The uri of the container image that will be used for the job run.
memoryLimit Integer
The memory computing resources in MB to allocate to each container running the job.
name String
The name of the job.
projectId Changes to this property will trigger replacement. String
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. String
region) The region of the Job.
timeout String
The job run timeout, in Go Time format (ex: 2h30m25s)
command string
The command that will be run in the container if specified.
cpuLimit number
The amount of vCPU computing resources to allocate to each container running the job.
cron JobDefinitionCron
The cron configuration
description string
The description of the job
env {[key: string]: string}
The environment variables of the container.
imageUri string
The uri of the container image that will be used for the job run.
memoryLimit number
The memory computing resources in MB to allocate to each container running the job.
name string
The name of the job.
projectId Changes to this property will trigger replacement. string
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. string
region) The region of the Job.
timeout string
The job run timeout, in Go Time format (ex: 2h30m25s)
command str
The command that will be run in the container if specified.
cpu_limit int
The amount of vCPU computing resources to allocate to each container running the job.
cron JobDefinitionCronArgs
The cron configuration
description str
The description of the job
env Mapping[str, str]
The environment variables of the container.
image_uri str
The uri of the container image that will be used for the job run.
memory_limit int
The memory computing resources in MB to allocate to each container running the job.
name str
The name of the job.
project_id Changes to this property will trigger replacement. str
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. str
region) The region of the Job.
timeout str
The job run timeout, in Go Time format (ex: 2h30m25s)
command String
The command that will be run in the container if specified.
cpuLimit Number
The amount of vCPU computing resources to allocate to each container running the job.
cron Property Map
The cron configuration
description String
The description of the job
env Map<String>
The environment variables of the container.
imageUri String
The uri of the container image that will be used for the job run.
memoryLimit Number
The memory computing resources in MB to allocate to each container running the job.
name String
The name of the job.
projectId Changes to this property will trigger replacement. String
project_id) The ID of the project the Job is associated with.
region Changes to this property will trigger replacement. String
region) The region of the Job.
timeout String
The job run timeout, in Go Time format (ex: 2h30m25s)

Supporting Types

JobDefinitionCron
, JobDefinitionCronArgs

Schedule This property is required. string
Cron format string.
Timezone This property is required. string
The timezone, must be a canonical TZ identifier as found in this list.
Schedule This property is required. string
Cron format string.
Timezone This property is required. string
The timezone, must be a canonical TZ identifier as found in this list.
schedule This property is required. String
Cron format string.
timezone This property is required. String
The timezone, must be a canonical TZ identifier as found in this list.
schedule This property is required. string
Cron format string.
timezone This property is required. string
The timezone, must be a canonical TZ identifier as found in this list.
schedule This property is required. str
Cron format string.
timezone This property is required. str
The timezone, must be a canonical TZ identifier as found in this list.
schedule This property is required. String
Cron format string.
timezone This property is required. String
The timezone, must be a canonical TZ identifier as found in this list.

Import

Serverless Jobs can be imported using the {region}/{id}, e.g.

bash

$ pulumi import scaleway:index/jobDefinition:JobDefinition job fr-par/11111111-1111-1111-1111-111111111111
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
scaleway pulumiverse/pulumi-scaleway
License
Apache-2.0
Notes
This Pulumi package is based on the scaleway Terraform Provider.