scaleway.JobDefinition
Explore with Pulumi AI
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", {
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.JobDefinition("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"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := scaleway.NewJobDefinition(ctx, "main", &scaleway.JobDefinitionArgs{
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: &scaleway.JobDefinitionCronArgs{
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.JobDefinition("main", new()
{
Name = "testjob",
CpuLimit = 140,
MemoryLimit = 256,
ImageUri = "docker.io/alpine:latest",
Command = "ls",
Timeout = "10m",
Env =
{
{ "foo", "bar" },
},
Cron = new Scaleway.Inputs.JobDefinitionCronArgs
{
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.JobDefinition;
import com.pulumi.scaleway.JobDefinitionArgs;
import com.pulumi.scaleway.inputs.JobDefinitionCronArgs;
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()
.name("testjob")
.cpuLimit(140)
.memoryLimit(256)
.imageUri("docker.io/alpine:latest")
.command("ls")
.timeout("10m")
.env(Map.of("foo", "bar"))
.cron(JobDefinitionCronArgs.builder()
.schedule("5 4 1 * *")
.timezone("Europe/Paris")
.build())
.build());
}
}
resources:
main:
type: scaleway:JobDefinition
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 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.
Constructor 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={
"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
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:
- 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 string
- The command that will be run in the container if specified.
- Cron
Pulumiverse.
Scaleway. Inputs. Job Definition Cron - The cron configuration
- Description string
- The description of the job
- Env Dictionary<string, string>
- The environment variables of the container.
- Image
Uri string - The uri of the container image that will be used for the job run.
- Name string
- The name of the job.
- Project
Id 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 string
- The command that will be run in the container if specified.
- Cron
Job
Definition Cron Args - The cron configuration
- Description string
- The description of the job
- Env map[string]string
- The environment variables of the container.
- Image
Uri string - The uri of the container image that will be used for the job run.
- Name string
- The name of the job.
- Project
Id 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 Integer - The amount of vCPU computing resources to allocate to each container running the job.
- memory
Limit 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
Job
Definition Cron - The cron configuration
- description String
- The description of the job
- env Map<String,String>
- The environment variables of the container.
- image
Uri String - The uri of the container image that will be used for the job run.
- name String
- The name of the job.
- project
Id 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 number - The amount of vCPU computing resources to allocate to each container running the job.
- memory
Limit 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
Job
Definition Cron - The cron configuration
- description string
- The description of the job
- env {[key: string]: string}
- The environment variables of the container.
- image
Uri string - The uri of the container image that will be used for the job run.
- name string
- The name of the job.
- project
Id 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
Job
Definition Cron 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
)
- cpu
Limit Number - The amount of vCPU computing resources to allocate to each container running the job.
- memory
Limit 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.
- image
Uri String - The uri of the container image that will be used for the job run.
- name String
- The name of the job.
- project
Id 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.
- Command string
- 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
Pulumiverse.
Scaleway. Inputs. Job Definition Cron - The cron configuration
- Description string
- The description of the job
- Env Dictionary<string, string>
- The environment variables of the container.
- Image
Uri string - 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 string
- The name of the job.
- Project
Id 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.
- Cpu
Limit int - The amount of vCPU computing resources to allocate to each container running the job.
- Cron
Job
Definition Cron Args - The cron configuration
- Description string
- The description of the job
- Env map[string]string
- The environment variables of the container.
- Image
Uri string - 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 string
- The name of the job.
- Project
Id 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.
- cpu
Limit Integer - The amount of vCPU computing resources to allocate to each container running the job.
- cron
Job
Definition Cron - The cron configuration
- description String
- The description of the job
- env Map<String,String>
- The environment variables of the container.
- image
Uri String - The uri of the container image that will be used for the job run.
- memory
Limit Integer - The memory computing resources in MB to allocate to each container running the job.
- name String
- The name of the job.
- project
Id 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.
- cpu
Limit number - The amount of vCPU computing resources to allocate to each container running the job.
- cron
Job
Definition Cron - The cron configuration
- description string
- The description of the job
- env {[key: string]: string}
- The environment variables of the container.
- image
Uri string - The uri of the container image that will be used for the job run.
- memory
Limit number - The memory computing resources in MB to allocate to each container running the job.
- name string
- The name of the job.
- project
Id 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
Job
Definition Cron 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.
- cpu
Limit 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.
- image
Uri String - The uri of the container image that will be used for the job run.
- memory
Limit Number - The memory computing resources in MB to allocate to each container running the job.
- name String
- The name of the job.
- project
Id 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
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.