1. Packages
  2. Scaleway
  3. API Docs
  4. JobDefinition
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

scaleway.JobDefinition

Explore with Pulumi AI

scaleway logo
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

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

    Example Usage

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const main = new scaleway.JobDefinition("main", {
        cpuLimit: 140,
        memoryLimit: 256,
        imageUri: "docker.io/alpine:latest",
        command: "ls",
        timeout: "10m",
        env: {
            foo: "bar",
        },
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    main = scaleway.JobDefinition("main",
        cpu_limit=140,
        memory_limit=256,
        image_uri="docker.io/alpine:latest",
        command="ls",
        timeout="10m",
        env={
            "foo": "bar",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := scaleway.NewJobDefinition(ctx, "main", &scaleway.JobDefinitionArgs{
    			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"),
    			},
    		})
    		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.JobDefinition("main", new()
        {
            CpuLimit = 140,
            MemoryLimit = 256,
            ImageUri = "docker.io/alpine:latest",
            Command = "ls",
            Timeout = "10m",
            Env = 
            {
                { "foo", "bar" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.JobDefinition;
    import com.pulumi.scaleway.JobDefinitionArgs;
    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 JobDefinition("main", JobDefinitionArgs.builder()        
                .cpuLimit(140)
                .memoryLimit(256)
                .imageUri("docker.io/alpine:latest")
                .command("ls")
                .timeout("10m")
                .env(Map.of("foo", "bar"))
                .build());
    
        }
    }
    
    resources:
      main:
        type: scaleway:JobDefinition
        properties:
          cpuLimit: 140
          memoryLimit: 256
          imageUri: docker.io/alpine:latest
          command: ls
          timeout: 10m
          env:
            foo: bar
    

    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,
                      cpu_limit: Optional[int] = None,
                      memory_limit: Optional[int] = None,
                      command: Optional[str] = None,
                      cron: Optional[JobDefinitionCronArgs] = 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 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 string
    The unique name of the resource.
    args JobDefinitionArgs
    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 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 string
    The unique name of the resource.
    args JobDefinitionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args JobDefinitionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args JobDefinitionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var jobDefinitionResource = new Scaleway.JobDefinition("jobDefinitionResource", new()
    {
        CpuLimit = 0,
        MemoryLimit = 0,
        Command = "string",
        Cron = new Scaleway.Inputs.JobDefinitionCronArgs
        {
            Schedule = "string",
            Timezone = "string",
        },
        Description = "string",
        Env = 
        {
            { "string", "string" },
        },
        ImageUri = "string",
        Name = "string",
        ProjectId = "string",
        Region = "string",
        Timeout = "string",
    });
    
    example, err := scaleway.NewJobDefinition(ctx, "jobDefinitionResource", &scaleway.JobDefinitionArgs{
    	CpuLimit:    pulumi.Int(0),
    	MemoryLimit: pulumi.Int(0),
    	Command:     pulumi.String("string"),
    	Cron: &scaleway.JobDefinitionCronArgs{
    		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 jobDefinitionResource = new JobDefinition("jobDefinitionResource", JobDefinitionArgs.builder()        
        .cpuLimit(0)
        .memoryLimit(0)
        .command("string")
        .cron(JobDefinitionCronArgs.builder()
            .schedule("string")
            .timezone("string")
            .build())
        .description("string")
        .env(Map.of("string", "string"))
        .imageUri("string")
        .name("string")
        .projectId("string")
        .region("string")
        .timeout("string")
        .build());
    
    job_definition_resource = scaleway.JobDefinition("jobDefinitionResource",
        cpu_limit=0,
        memory_limit=0,
        command="string",
        cron=scaleway.JobDefinitionCronArgs(
            schedule="string",
            timezone="string",
        ),
        description="string",
        env={
            "string": "string",
        },
        image_uri="string",
        name="string",
        project_id="string",
        region="string",
        timeout="string")
    
    const jobDefinitionResource = new scaleway.JobDefinition("jobDefinitionResource", {
        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:JobDefinition
    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
    

    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

    The JobDefinition 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.Inputs.JobDefinitionCron
    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 JobDefinitionCronArgs
    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 JobDefinitionCron
    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 JobDefinitionCron
    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 JobDefinitionCronArgs
    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
    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 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)
    Resource lookup is not supported in YAML
    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.
    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
    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 JobDefinitionCronArgs
    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 JobDefinitionCron
    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 JobDefinitionCron
    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 JobDefinitionCronArgs
    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
    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

    JobDefinitionCron, JobDefinitionCronArgs

    Schedule string
    Timezone string
    Schedule string
    Timezone string
    schedule String
    timezone String
    schedule string
    timezone string
    schedule String
    timezone String

    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
    

    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.
    scaleway logo
    Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse