scaleway.job.Definition
Explore with Pulumi AI
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",
    },
});
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",
    })
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
	})
}
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",
        },
    });
});
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());
    }
}
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
Create Definition Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Definition(name: string, args: DefinitionArgs, opts?: CustomResourceOptions);@overload
def Definition(resource_name: str,
               args: DefinitionArgs,
               opts: Optional[ResourceOptions] = None)
@overload
def Definition(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               cpu_limit: Optional[int] = None,
               memory_limit: Optional[int] = None,
               command: Optional[str] = None,
               cron: Optional[DefinitionCronArgs] = None,
               description: Optional[str] = None,
               env: Optional[Mapping[str, str]] = None,
               image_uri: Optional[str] = None,
               name: Optional[str] = None,
               project_id: Optional[str] = None,
               region: Optional[str] = None,
               timeout: Optional[str] = None)func NewDefinition(ctx *Context, name string, args DefinitionArgs, opts ...ResourceOption) (*Definition, error)public Definition(string name, DefinitionArgs args, CustomResourceOptions? opts = null)
public Definition(String name, DefinitionArgs args)
public Definition(String name, DefinitionArgs args, CustomResourceOptions options)
type: scaleway:job:Definition
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args DefinitionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args DefinitionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DefinitionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DefinitionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DefinitionArgs
- 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 definitionResource = new Scaleway.Job.Definition("definitionResource", new()
{
    CpuLimit = 0,
    MemoryLimit = 0,
    Command = "string",
    Cron = new Scaleway.Job.Inputs.DefinitionCronArgs
    {
        Schedule = "string",
        Timezone = "string",
    },
    Description = "string",
    Env = 
    {
        { "string", "string" },
    },
    ImageUri = "string",
    Name = "string",
    ProjectId = "string",
    Region = "string",
    Timeout = "string",
});
example, err := job.NewDefinition(ctx, "definitionResource", &job.DefinitionArgs{
	CpuLimit:    pulumi.Int(0),
	MemoryLimit: pulumi.Int(0),
	Command:     pulumi.String("string"),
	Cron: &job.DefinitionCronArgs{
		Schedule: pulumi.String("string"),
		Timezone: pulumi.String("string"),
	},
	Description: pulumi.String("string"),
	Env: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	ImageUri:  pulumi.String("string"),
	Name:      pulumi.String("string"),
	ProjectId: pulumi.String("string"),
	Region:    pulumi.String("string"),
	Timeout:   pulumi.String("string"),
})
var definitionResource = new Definition("definitionResource", DefinitionArgs.builder()
    .cpuLimit(0)
    .memoryLimit(0)
    .command("string")
    .cron(DefinitionCronArgs.builder()
        .schedule("string")
        .timezone("string")
        .build())
    .description("string")
    .env(Map.of("string", "string"))
    .imageUri("string")
    .name("string")
    .projectId("string")
    .region("string")
    .timeout("string")
    .build());
definition_resource = scaleway.job.Definition("definitionResource",
    cpu_limit=0,
    memory_limit=0,
    command="string",
    cron={
        "schedule": "string",
        "timezone": "string",
    },
    description="string",
    env={
        "string": "string",
    },
    image_uri="string",
    name="string",
    project_id="string",
    region="string",
    timeout="string")
const definitionResource = new scaleway.job.Definition("definitionResource", {
    cpuLimit: 0,
    memoryLimit: 0,
    command: "string",
    cron: {
        schedule: "string",
        timezone: "string",
    },
    description: "string",
    env: {
        string: "string",
    },
    imageUri: "string",
    name: "string",
    projectId: "string",
    region: "string",
    timeout: "string",
});
type: scaleway:job:Definition
properties:
    command: string
    cpuLimit: 0
    cron:
        schedule: string
        timezone: string
    description: string
    env:
        string: string
    imageUri: string
    memoryLimit: 0
    name: string
    projectId: string
    region: string
    timeout: string
Definition 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 Definition resource accepts the following input properties:
- CpuLimit int
- The amount of vCPU computing resources to allocate to each container running the job.
- MemoryLimit 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. Job. Inputs. Definition Cron 
- 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 string
- project_id) The ID of the project the Job is associated with.
- Region string
- region) The region of the Job.
- Timeout string
- The job run timeout, in Go Time format (ex: 2h30m25s)
- CpuLimit int
- The amount of vCPU computing resources to allocate to each container running the job.
- MemoryLimit 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
DefinitionCron Args 
- 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 string
- project_id) The ID of the project the Job is associated with.
- Region string
- region) The region of the Job.
- Timeout string
- The job run timeout, in Go Time format (ex: 2h30m25s)
- cpuLimit Integer
- The amount of vCPU computing resources to allocate to each container running the job.
- memoryLimit 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
DefinitionCron 
- 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 String
- project_id) The ID of the project the Job is associated with.
- region String
- region) The region of the Job.
- timeout String
- The job run timeout, in Go Time format (ex: 2h30m25s)
- cpuLimit number
- The amount of vCPU computing resources to allocate to each container running the job.
- memoryLimit 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
DefinitionCron 
- 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 string
- project_id) The ID of the project the Job is associated with.
- region string
- region) The region of the Job.
- timeout string
- The job run timeout, in Go Time format (ex: 2h30m25s)
- cpu_limit int
- The amount of vCPU computing resources to allocate to each container running the job.
- memory_limit 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
DefinitionCron Args 
- 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 str
- project_id) The ID of the project the Job is associated with.
- region str
- region) The region of the Job.
- timeout str
- The job run timeout, in Go Time format (ex: 2h30m25s)
- cpuLimit Number
- The amount of vCPU computing resources to allocate to each container running the job.
- memoryLimit 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 String
- project_id) The ID of the project the Job is associated with.
- region 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 Definition 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 Definition Resource
Get an existing Definition 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?: DefinitionState, opts?: CustomResourceOptions): Definition@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        command: Optional[str] = None,
        cpu_limit: Optional[int] = None,
        cron: Optional[DefinitionCronArgs] = 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) -> Definitionfunc GetDefinition(ctx *Context, name string, id IDInput, state *DefinitionState, opts ...ResourceOption) (*Definition, error)public static Definition Get(string name, Input<string> id, DefinitionState? state, CustomResourceOptions? opts = null)public static Definition get(String name, Output<String> id, DefinitionState state, CustomResourceOptions options)resources:  _:    type: scaleway:job:Definition    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- 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. Job. Inputs. Definition Cron 
- 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 string
- project_id) The ID of the project the Job is associated with.
- Region 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
DefinitionCron Args 
- 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 string
- project_id) The ID of the project the Job is associated with.
- Region 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
DefinitionCron 
- 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 String
- project_id) The ID of the project the Job is associated with.
- region 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
DefinitionCron 
- 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 string
- project_id) The ID of the project the Job is associated with.
- region 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
DefinitionCron Args 
- 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 str
- project_id) The ID of the project the Job is associated with.
- region 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 String
- project_id) The ID of the project the Job is associated with.
- region String
- region) The region of the Job.
- timeout String
- The job run timeout, in Go Time format (ex: 2h30m25s)
Supporting Types
DefinitionCron, DefinitionCronArgs    
Import
Serverless Jobs can be imported using the {region}/{id}, e.g.
bash
$ pulumi import scaleway:job/definition:Definition job fr-par/11111111-1111-1111-1111-111111111111
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 scalewayTerraform Provider.
