com.pulumi.gcp.cloudrunv2.kotlin.Job.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.cloudrunv2.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobBinaryAuthorization
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobCondition
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobLatestCreatedExecution
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobTemplate
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobTerminalCondition
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobBinaryAuthorization.Companion.toKotlin as jobBinaryAuthorizationToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobCondition.Companion.toKotlin as jobConditionToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobLatestCreatedExecution.Companion.toKotlin as jobLatestCreatedExecutionToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobTemplate.Companion.toKotlin as jobTemplateToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.JobTerminalCondition.Companion.toKotlin as jobTerminalConditionToKotlin
/**
* Builder for [Job].
*/
@PulumiTagMarker
public class JobResourceBuilder internal constructor() {
public var name: String? = null
public var args: JobArgs = JobArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend JobArgsBuilder.() -> Unit) {
val builder = JobArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Job {
val builtJavaResource = com.pulumi.gcp.cloudrunv2.Job(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Job(builtJavaResource)
}
}
/**
* A Cloud Run Job resource that references a container image which is run to completion.
* To get more information about Job, see:
* * [API documentation](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.jobs)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/run/docs/)
* ## Example Usage
* ### Cloudrunv2 Job Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* template: {
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* )],
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* 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 default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* template:
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* ```
*
* ### Cloudrunv2 Job Limits
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* template: {
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* resources: {
* limits: {
* cpu: "2",
* memory: "1024Mi",
* },
* },
* }],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* resources=gcp.cloudrunv2.JobTemplateTemplateContainerResourcesArgs(
* limits={
* "cpu": "2",
* "memory": "1024Mi",
* },
* ),
* )],
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* Resources = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerResourcesArgs
* {
* Limits =
* {
* { "cpu", "2" },
* { "memory", "1024Mi" },
* },
* },
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* Resources: &cloudrunv2.JobTemplateTemplateContainerResourcesArgs{
* Limits: pulumi.StringMap{
* "cpu": pulumi.String("2"),
* "memory": pulumi.String("1024Mi"),
* },
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* 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 default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .resources(JobTemplateTemplateContainerResourcesArgs.builder()
* .limits(Map.ofEntries(
* Map.entry("cpu", "2"),
* Map.entry("memory", "1024Mi")
* ))
* .build())
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* template:
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* resources:
* limits:
* cpu: '2'
* memory: 1024Mi
* ```
*
* ### Cloudrunv2 Job Sql
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const secret = new gcp.secretmanager.Secret("secret", {
* secretId: "secret",
* replication: {
* auto: {},
* },
* });
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "cloudrun-sql",
* region: "us-central1",
* databaseVersion: "MYSQL_5_7",
* settings: {
* tier: "db-f1-micro",
* },
* deletionProtection: true,
* });
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* template: {
* template: {
* volumes: [{
* name: "cloudsql",
* cloudSqlInstance: {
* instances: [instance.connectionName],
* },
* }],
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* envs: [
* {
* name: "FOO",
* value: "bar",
* },
* {
* name: "latestdclsecret",
* valueSource: {
* secretKeyRef: {
* secret: secret.secretId,
* version: "1",
* },
* },
* },
* ],
* volumeMounts: [{
* name: "cloudsql",
* mountPath: "/cloudsql",
* }],
* }],
* },
* },
* });
* const project = gcp.organizations.getProject({});
* const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
* secret: secret.name,
* secretData: "secret-data",
* });
* const secret_access = new gcp.secretmanager.SecretIamMember("secret-access", {
* secretId: secret.id,
* role: "roles/secretmanager.secretAccessor",
* member: project.then(project => `serviceAccount:${project.number}[email protected]`),
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secret = gcp.secretmanager.Secret("secret",
* secret_id="secret",
* replication=gcp.secretmanager.SecretReplicationArgs(
* auto=gcp.secretmanager.SecretReplicationAutoArgs(),
* ))
* instance = gcp.sql.DatabaseInstance("instance",
* name="cloudrun-sql",
* region="us-central1",
* database_version="MYSQL_5_7",
* settings=gcp.sql.DatabaseInstanceSettingsArgs(
* tier="db-f1-micro",
* ),
* deletion_protection=True)
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* volumes=[gcp.cloudrunv2.JobTemplateTemplateVolumeArgs(
* name="cloudsql",
* cloud_sql_instance=gcp.cloudrunv2.JobTemplateTemplateVolumeCloudSqlInstanceArgs(
* instances=[instance.connection_name],
* ),
* )],
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* envs=[
* gcp.cloudrunv2.JobTemplateTemplateContainerEnvArgs(
* name="FOO",
* value="bar",
* ),
* gcp.cloudrunv2.JobTemplateTemplateContainerEnvArgs(
* name="latestdclsecret",
* value_source=gcp.cloudrunv2.JobTemplateTemplateContainerEnvValueSourceArgs(
* secret_key_ref=gcp.cloudrunv2.JobTemplateTemplateContainerEnvValueSourceSecretKeyRefArgs(
* secret=secret.secret_id,
* version="1",
* ),
* ),
* ),
* ],
* volume_mounts=[gcp.cloudrunv2.JobTemplateTemplateContainerVolumeMountArgs(
* name="cloudsql",
* mount_path="/cloudsql",
* )],
* )],
* ),
* ))
* project = gcp.organizations.get_project()
* secret_version_data = gcp.secretmanager.SecretVersion("secret-version-data",
* secret=secret.name,
* secret_data="secret-data")
* secret_access = gcp.secretmanager.SecretIamMember("secret-access",
* secret_id=secret.id,
* role="roles/secretmanager.secretAccessor",
* member=f"serviceAccount:{project.number}[email protected]")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var secret = new Gcp.SecretManager.Secret("secret", new()
* {
* SecretId = "secret",
* Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
* {
* Auto = null,
* },
* });
* var instance = new Gcp.Sql.DatabaseInstance("instance", new()
* {
* Name = "cloudrun-sql",
* Region = "us-central1",
* DatabaseVersion = "MYSQL_5_7",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* DeletionProtection = true,
* });
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeArgs
* {
* Name = "cloudsql",
* CloudSqlInstance = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeCloudSqlInstanceArgs
* {
* Instances = new[]
* {
* instance.ConnectionName,
* },
* },
* },
* },
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* Envs = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerEnvArgs
* {
* Name = "FOO",
* Value = "bar",
* },
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerEnvArgs
* {
* Name = "latestdclsecret",
* ValueSource = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerEnvValueSourceArgs
* {
* SecretKeyRef = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerEnvValueSourceSecretKeyRefArgs
* {
* Secret = secret.SecretId,
* Version = "1",
* },
* },
* },
* },
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerVolumeMountArgs
* {
* Name = "cloudsql",
* MountPath = "/cloudsql",
* },
* },
* },
* },
* },
* },
* });
* var project = Gcp.Organizations.GetProject.Invoke();
* var secret_version_data = new Gcp.SecretManager.SecretVersion("secret-version-data", new()
* {
* Secret = secret.Name,
* SecretData = "secret-data",
* });
* var secret_access = new Gcp.SecretManager.SecretIamMember("secret-access", new()
* {
* SecretId = secret.Id,
* Role = "roles/secretmanager.secretAccessor",
* Member = $"serviceAccount:{project.Apply(getProjectResult => getProjectResult.Number)}[email protected]",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* secret, err := secretmanager.NewSecret(ctx, "secret", &secretmanager.SecretArgs{
* SecretId: pulumi.String("secret"),
* Replication: &secretmanager.SecretReplicationArgs{
* Auto: nil,
* },
* })
* if err != nil {
* return err
* }
* instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
* Name: pulumi.String("cloudrun-sql"),
* Region: pulumi.String("us-central1"),
* DatabaseVersion: pulumi.String("MYSQL_5_7"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* DeletionProtection: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* _, err = cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Volumes: cloudrunv2.JobTemplateTemplateVolumeArray{
* &cloudrunv2.JobTemplateTemplateVolumeArgs{
* Name: pulumi.String("cloudsql"),
* CloudSqlInstance: &cloudrunv2.JobTemplateTemplateVolumeCloudSqlInstanceArgs{
* Instances: pulumi.StringArray{
* instance.ConnectionName,
* },
* },
* },
* },
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* Envs: cloudrunv2.JobTemplateTemplateContainerEnvArray{
* &cloudrunv2.JobTemplateTemplateContainerEnvArgs{
* Name: pulumi.String("FOO"),
* Value: pulumi.String("bar"),
* },
* &cloudrunv2.JobTemplateTemplateContainerEnvArgs{
* Name: pulumi.String("latestdclsecret"),
* ValueSource: &cloudrunv2.JobTemplateTemplateContainerEnvValueSourceArgs{
* SecretKeyRef: &cloudrunv2.JobTemplateTemplateContainerEnvValueSourceSecretKeyRefArgs{
* Secret: secret.SecretId,
* Version: pulumi.String("1"),
* },
* },
* },
* },
* VolumeMounts: cloudrunv2.JobTemplateTemplateContainerVolumeMountArray{
* &cloudrunv2.JobTemplateTemplateContainerVolumeMountArgs{
* Name: pulumi.String("cloudsql"),
* MountPath: pulumi.String("/cloudsql"),
* },
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretVersion(ctx, "secret-version-data", &secretmanager.SecretVersionArgs{
* Secret: secret.Name,
* SecretData: pulumi.String("secret-data"),
* })
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretIamMember(ctx, "secret-access", &secretmanager.SecretIamMemberArgs{
* SecretId: secret.ID(),
* Role: pulumi.String("roles/secretmanager.secretAccessor"),
* Member: pulumi.String(fmt.Sprintf("serviceAccount:%[email protected]", project.Number)),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.secretmanager.Secret;
* import com.pulumi.gcp.secretmanager.SecretArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.secretmanager.SecretVersion;
* import com.pulumi.gcp.secretmanager.SecretVersionArgs;
* import com.pulumi.gcp.secretmanager.SecretIamMember;
* import com.pulumi.gcp.secretmanager.SecretIamMemberArgs;
* 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 secret = new Secret("secret", SecretArgs.builder()
* .secretId("secret")
* .replication(SecretReplicationArgs.builder()
* .auto()
* .build())
* .build());
* var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
* .name("cloudrun-sql")
* .region("us-central1")
* .databaseVersion("MYSQL_5_7")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .deletionProtection("true")
* .build());
* var default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .volumes(JobTemplateTemplateVolumeArgs.builder()
* .name("cloudsql")
* .cloudSqlInstance(JobTemplateTemplateVolumeCloudSqlInstanceArgs.builder()
* .instances(instance.connectionName())
* .build())
* .build())
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .envs(
* JobTemplateTemplateContainerEnvArgs.builder()
* .name("FOO")
* .value("bar")
* .build(),
* JobTemplateTemplateContainerEnvArgs.builder()
* .name("latestdclsecret")
* .valueSource(JobTemplateTemplateContainerEnvValueSourceArgs.builder()
* .secretKeyRef(JobTemplateTemplateContainerEnvValueSourceSecretKeyRefArgs.builder()
* .secret(secret.secretId())
* .version("1")
* .build())
* .build())
* .build())
* .volumeMounts(JobTemplateTemplateContainerVolumeMountArgs.builder()
* .name("cloudsql")
* .mountPath("/cloudsql")
* .build())
* .build())
* .build())
* .build())
* .build());
* final var project = OrganizationsFunctions.getProject();
* var secret_version_data = new SecretVersion("secret-version-data", SecretVersionArgs.builder()
* .secret(secret.name())
* .secretData("secret-data")
* .build());
* var secret_access = new SecretIamMember("secret-access", SecretIamMemberArgs.builder()
* .secretId(secret.id())
* .role("roles/secretmanager.secretAccessor")
* .member(String.format("serviceAccount:%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* template:
* template:
* volumes:
* - name: cloudsql
* cloudSqlInstance:
* instances:
* - ${instance.connectionName}
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* envs:
* - name: FOO
* value: bar
* - name: latestdclsecret
* valueSource:
* secretKeyRef:
* secret: ${secret.secretId}
* version: '1'
* volumeMounts:
* - name: cloudsql
* mountPath: /cloudsql
* secret:
* type: gcp:secretmanager:Secret
* properties:
* secretId: secret
* replication:
* auto: {}
* secret-version-data:
* type: gcp:secretmanager:SecretVersion
* properties:
* secret: ${secret.name}
* secretData: secret-data
* secret-access:
* type: gcp:secretmanager:SecretIamMember
* properties:
* secretId: ${secret.id}
* role: roles/secretmanager.secretAccessor
* member: serviceAccount:${project.number}[email protected]
* instance:
* type: gcp:sql:DatabaseInstance
* properties:
* name: cloudrun-sql
* region: us-central1
* databaseVersion: MYSQL_5_7
* settings:
* tier: db-f1-micro
* deletionProtection: 'true'
* variables:
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* ```
*
* ### Cloudrunv2 Job Vpcaccess
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const customTestNetwork = new gcp.compute.Network("custom_test", {
* name: "run-network",
* autoCreateSubnetworks: false,
* });
* const customTest = new gcp.compute.Subnetwork("custom_test", {
* name: "run-subnetwork",
* ipCidrRange: "10.2.0.0/28",
* region: "us-central1",
* network: customTestNetwork.id,
* });
* const connector = new gcp.vpcaccess.Connector("connector", {
* name: "run-vpc",
* subnet: {
* name: customTest.name,
* },
* machineType: "e2-standard-4",
* minInstances: 2,
* maxInstances: 3,
* region: "us-central1",
* });
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* template: {
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* vpcAccess: {
* connector: connector.id,
* egress: "ALL_TRAFFIC",
* },
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* custom_test_network = gcp.compute.Network("custom_test",
* name="run-network",
* auto_create_subnetworks=False)
* custom_test = gcp.compute.Subnetwork("custom_test",
* name="run-subnetwork",
* ip_cidr_range="10.2.0.0/28",
* region="us-central1",
* network=custom_test_network.id)
* connector = gcp.vpcaccess.Connector("connector",
* name="run-vpc",
* subnet=gcp.vpcaccess.ConnectorSubnetArgs(
* name=custom_test.name,
* ),
* machine_type="e2-standard-4",
* min_instances=2,
* max_instances=3,
* region="us-central1")
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* )],
* vpc_access=gcp.cloudrunv2.JobTemplateTemplateVpcAccessArgs(
* connector=connector.id,
* egress="ALL_TRAFFIC",
* ),
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var customTestNetwork = new Gcp.Compute.Network("custom_test", new()
* {
* Name = "run-network",
* AutoCreateSubnetworks = false,
* });
* var customTest = new Gcp.Compute.Subnetwork("custom_test", new()
* {
* Name = "run-subnetwork",
* IpCidrRange = "10.2.0.0/28",
* Region = "us-central1",
* Network = customTestNetwork.Id,
* });
* var connector = new Gcp.VpcAccess.Connector("connector", new()
* {
* Name = "run-vpc",
* Subnet = new Gcp.VpcAccess.Inputs.ConnectorSubnetArgs
* {
* Name = customTest.Name,
* },
* MachineType = "e2-standard-4",
* MinInstances = 2,
* MaxInstances = 3,
* Region = "us-central1",
* });
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* },
* },
* VpcAccess = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVpcAccessArgs
* {
* Connector = connector.Id,
* Egress = "ALL_TRAFFIC",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/vpcaccess"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* customTestNetwork, err := compute.NewNetwork(ctx, "custom_test", &compute.NetworkArgs{
* Name: pulumi.String("run-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* customTest, err := compute.NewSubnetwork(ctx, "custom_test", &compute.SubnetworkArgs{
* Name: pulumi.String("run-subnetwork"),
* IpCidrRange: pulumi.String("10.2.0.0/28"),
* Region: pulumi.String("us-central1"),
* Network: customTestNetwork.ID(),
* })
* if err != nil {
* return err
* }
* connector, err := vpcaccess.NewConnector(ctx, "connector", &vpcaccess.ConnectorArgs{
* Name: pulumi.String("run-vpc"),
* Subnet: &vpcaccess.ConnectorSubnetArgs{
* Name: customTest.Name,
* },
* MachineType: pulumi.String("e2-standard-4"),
* MinInstances: pulumi.Int(2),
* MaxInstances: pulumi.Int(3),
* Region: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* _, err = cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* },
* },
* VpcAccess: &cloudrunv2.JobTemplateTemplateVpcAccessArgs{
* Connector: connector.ID(),
* Egress: pulumi.String("ALL_TRAFFIC"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.vpcaccess.Connector;
* import com.pulumi.gcp.vpcaccess.ConnectorArgs;
* import com.pulumi.gcp.vpcaccess.inputs.ConnectorSubnetArgs;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateVpcAccessArgs;
* 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 customTestNetwork = new Network("customTestNetwork", NetworkArgs.builder()
* .name("run-network")
* .autoCreateSubnetworks(false)
* .build());
* var customTest = new Subnetwork("customTest", SubnetworkArgs.builder()
* .name("run-subnetwork")
* .ipCidrRange("10.2.0.0/28")
* .region("us-central1")
* .network(customTestNetwork.id())
* .build());
* var connector = new Connector("connector", ConnectorArgs.builder()
* .name("run-vpc")
* .subnet(ConnectorSubnetArgs.builder()
* .name(customTest.name())
* .build())
* .machineType("e2-standard-4")
* .minInstances(2)
* .maxInstances(3)
* .region("us-central1")
* .build());
* var default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .build())
* .vpcAccess(JobTemplateTemplateVpcAccessArgs.builder()
* .connector(connector.id())
* .egress("ALL_TRAFFIC")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* template:
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* vpcAccess:
* connector: ${connector.id}
* egress: ALL_TRAFFIC
* connector:
* type: gcp:vpcaccess:Connector
* properties:
* name: run-vpc
* subnet:
* name: ${customTest.name}
* machineType: e2-standard-4
* minInstances: 2
* maxInstances: 3
* region: us-central1
* customTest:
* type: gcp:compute:Subnetwork
* name: custom_test
* properties:
* name: run-subnetwork
* ipCidrRange: 10.2.0.0/28
* region: us-central1
* network: ${customTestNetwork.id}
* customTestNetwork:
* type: gcp:compute:Network
* name: custom_test
* properties:
* name: run-network
* autoCreateSubnetworks: false
* ```
*
* ### Cloudrunv2 Job Directvpc
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* launchStage: "GA",
* template: {
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/job",
* }],
* vpcAccess: {
* networkInterfaces: [{
* network: "default",
* subnetwork: "default",
* tags: [
* "tag1",
* "tag2",
* "tag3",
* ],
* }],
* },
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* launch_stage="GA",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/job",
* )],
* vpc_access=gcp.cloudrunv2.JobTemplateTemplateVpcAccessArgs(
* network_interfaces=[gcp.cloudrunv2.JobTemplateTemplateVpcAccessNetworkInterfaceArgs(
* network="default",
* subnetwork="default",
* tags=[
* "tag1",
* "tag2",
* "tag3",
* ],
* )],
* ),
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* LaunchStage = "GA",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/job",
* },
* },
* VpcAccess = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVpcAccessArgs
* {
* NetworkInterfaces = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVpcAccessNetworkInterfaceArgs
* {
* Network = "default",
* Subnetwork = "default",
* Tags = new[]
* {
* "tag1",
* "tag2",
* "tag3",
* },
* },
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* LaunchStage: pulumi.String("GA"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/job"),
* },
* },
* VpcAccess: &cloudrunv2.JobTemplateTemplateVpcAccessArgs{
* NetworkInterfaces: cloudrunv2.JobTemplateTemplateVpcAccessNetworkInterfaceArray{
* &cloudrunv2.JobTemplateTemplateVpcAccessNetworkInterfaceArgs{
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* Tags: pulumi.StringArray{
* pulumi.String("tag1"),
* pulumi.String("tag2"),
* pulumi.String("tag3"),
* },
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateVpcAccessArgs;
* 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 default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .launchStage("GA")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/job")
* .build())
* .vpcAccess(JobTemplateTemplateVpcAccessArgs.builder()
* .networkInterfaces(JobTemplateTemplateVpcAccessNetworkInterfaceArgs.builder()
* .network("default")
* .subnetwork("default")
* .tags(
* "tag1",
* "tag2",
* "tag3")
* .build())
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* launchStage: GA
* template:
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/job
* vpcAccess:
* networkInterfaces:
* - network: default
* subnetwork: default
* tags:
* - tag1
* - tag2
* - tag3
* ```
*
* ### Cloudrunv2 Job Secret
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const secret = new gcp.secretmanager.Secret("secret", {
* secretId: "secret",
* replication: {
* auto: {},
* },
* });
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* template: {
* template: {
* volumes: [{
* name: "a-volume",
* secret: {
* secret: secret.secretId,
* defaultMode: 292,
* items: [{
* version: "1",
* path: "my-secret",
* mode: 256,
* }],
* },
* }],
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* volumeMounts: [{
* name: "a-volume",
* mountPath: "/secrets",
* }],
* }],
* },
* },
* });
* const project = gcp.organizations.getProject({});
* const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
* secret: secret.name,
* secretData: "secret-data",
* });
* const secret_access = new gcp.secretmanager.SecretIamMember("secret-access", {
* secretId: secret.id,
* role: "roles/secretmanager.secretAccessor",
* member: project.then(project => `serviceAccount:${project.number}[email protected]`),
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secret = gcp.secretmanager.Secret("secret",
* secret_id="secret",
* replication=gcp.secretmanager.SecretReplicationArgs(
* auto=gcp.secretmanager.SecretReplicationAutoArgs(),
* ))
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* volumes=[gcp.cloudrunv2.JobTemplateTemplateVolumeArgs(
* name="a-volume",
* secret=gcp.cloudrunv2.JobTemplateTemplateVolumeSecretArgs(
* secret=secret.secret_id,
* default_mode=292,
* items=[gcp.cloudrunv2.JobTemplateTemplateVolumeSecretItemArgs(
* version="1",
* path="my-secret",
* mode=256,
* )],
* ),
* )],
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* volume_mounts=[gcp.cloudrunv2.JobTemplateTemplateContainerVolumeMountArgs(
* name="a-volume",
* mount_path="/secrets",
* )],
* )],
* ),
* ))
* project = gcp.organizations.get_project()
* secret_version_data = gcp.secretmanager.SecretVersion("secret-version-data",
* secret=secret.name,
* secret_data="secret-data")
* secret_access = gcp.secretmanager.SecretIamMember("secret-access",
* secret_id=secret.id,
* role="roles/secretmanager.secretAccessor",
* member=f"serviceAccount:{project.number}[email protected]")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var secret = new Gcp.SecretManager.Secret("secret", new()
* {
* SecretId = "secret",
* Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
* {
* Auto = null,
* },
* });
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeArgs
* {
* Name = "a-volume",
* Secret = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeSecretArgs
* {
* Secret = secret.SecretId,
* DefaultMode = 292,
* Items = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeSecretItemArgs
* {
* Version = "1",
* Path = "my-secret",
* Mode = 256,
* },
* },
* },
* },
* },
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerVolumeMountArgs
* {
* Name = "a-volume",
* MountPath = "/secrets",
* },
* },
* },
* },
* },
* },
* });
* var project = Gcp.Organizations.GetProject.Invoke();
* var secret_version_data = new Gcp.SecretManager.SecretVersion("secret-version-data", new()
* {
* Secret = secret.Name,
* SecretData = "secret-data",
* });
* var secret_access = new Gcp.SecretManager.SecretIamMember("secret-access", new()
* {
* SecretId = secret.Id,
* Role = "roles/secretmanager.secretAccessor",
* Member = $"serviceAccount:{project.Apply(getProjectResult => getProjectResult.Number)}[email protected]",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* secret, err := secretmanager.NewSecret(ctx, "secret", &secretmanager.SecretArgs{
* SecretId: pulumi.String("secret"),
* Replication: &secretmanager.SecretReplicationArgs{
* Auto: nil,
* },
* })
* if err != nil {
* return err
* }
* _, err = cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Volumes: cloudrunv2.JobTemplateTemplateVolumeArray{
* &cloudrunv2.JobTemplateTemplateVolumeArgs{
* Name: pulumi.String("a-volume"),
* Secret: &cloudrunv2.JobTemplateTemplateVolumeSecretArgs{
* Secret: secret.SecretId,
* DefaultMode: pulumi.Int(292),
* Items: cloudrunv2.JobTemplateTemplateVolumeSecretItemArray{
* &cloudrunv2.JobTemplateTemplateVolumeSecretItemArgs{
* Version: pulumi.String("1"),
* Path: pulumi.String("my-secret"),
* Mode: pulumi.Int(256),
* },
* },
* },
* },
* },
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* VolumeMounts: cloudrunv2.JobTemplateTemplateContainerVolumeMountArray{
* &cloudrunv2.JobTemplateTemplateContainerVolumeMountArgs{
* Name: pulumi.String("a-volume"),
* MountPath: pulumi.String("/secrets"),
* },
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretVersion(ctx, "secret-version-data", &secretmanager.SecretVersionArgs{
* Secret: secret.Name,
* SecretData: pulumi.String("secret-data"),
* })
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretIamMember(ctx, "secret-access", &secretmanager.SecretIamMemberArgs{
* SecretId: secret.ID(),
* Role: pulumi.String("roles/secretmanager.secretAccessor"),
* Member: pulumi.String(fmt.Sprintf("serviceAccount:%[email protected]", project.Number)),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.secretmanager.Secret;
* import com.pulumi.gcp.secretmanager.SecretArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.secretmanager.SecretVersion;
* import com.pulumi.gcp.secretmanager.SecretVersionArgs;
* import com.pulumi.gcp.secretmanager.SecretIamMember;
* import com.pulumi.gcp.secretmanager.SecretIamMemberArgs;
* 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 secret = new Secret("secret", SecretArgs.builder()
* .secretId("secret")
* .replication(SecretReplicationArgs.builder()
* .auto()
* .build())
* .build());
* var default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .volumes(JobTemplateTemplateVolumeArgs.builder()
* .name("a-volume")
* .secret(JobTemplateTemplateVolumeSecretArgs.builder()
* .secret(secret.secretId())
* .defaultMode(292)
* .items(JobTemplateTemplateVolumeSecretItemArgs.builder()
* .version("1")
* .path("my-secret")
* .mode(256)
* .build())
* .build())
* .build())
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .volumeMounts(JobTemplateTemplateContainerVolumeMountArgs.builder()
* .name("a-volume")
* .mountPath("/secrets")
* .build())
* .build())
* .build())
* .build())
* .build());
* final var project = OrganizationsFunctions.getProject();
* var secret_version_data = new SecretVersion("secret-version-data", SecretVersionArgs.builder()
* .secret(secret.name())
* .secretData("secret-data")
* .build());
* var secret_access = new SecretIamMember("secret-access", SecretIamMemberArgs.builder()
* .secretId(secret.id())
* .role("roles/secretmanager.secretAccessor")
* .member(String.format("serviceAccount:%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* template:
* template:
* volumes:
* - name: a-volume
* secret:
* secret: ${secret.secretId}
* defaultMode: 292
* items:
* - version: '1'
* path: my-secret
* mode: 256
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* volumeMounts:
* - name: a-volume
* mountPath: /secrets
* secret:
* type: gcp:secretmanager:Secret
* properties:
* secretId: secret
* replication:
* auto: {}
* secret-version-data:
* type: gcp:secretmanager:SecretVersion
* properties:
* secret: ${secret.name}
* secretData: secret-data
* secret-access:
* type: gcp:secretmanager:SecretIamMember
* properties:
* secretId: ${secret.id}
* role: roles/secretmanager.secretAccessor
* member: serviceAccount:${project.number}[email protected]
* variables:
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* ```
*
* ### Cloudrunv2 Job Emptydir
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Job("default", {
* name: "cloudrun-job",
* location: "us-central1",
* launchStage: "BETA",
* template: {
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* volumeMounts: [{
* name: "empty-dir-volume",
* mountPath: "/mnt",
* }],
* }],
* volumes: [{
* name: "empty-dir-volume",
* emptyDir: {
* medium: "MEMORY",
* sizeLimit: "128Mi",
* },
* }],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Job("default",
* name="cloudrun-job",
* location="us-central1",
* launch_stage="BETA",
* template=gcp.cloudrunv2.JobTemplateArgs(
* template=gcp.cloudrunv2.JobTemplateTemplateArgs(
* containers=[gcp.cloudrunv2.JobTemplateTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* volume_mounts=[gcp.cloudrunv2.JobTemplateTemplateContainerVolumeMountArgs(
* name="empty-dir-volume",
* mount_path="/mnt",
* )],
* )],
* volumes=[gcp.cloudrunv2.JobTemplateTemplateVolumeArgs(
* name="empty-dir-volume",
* empty_dir=gcp.cloudrunv2.JobTemplateTemplateVolumeEmptyDirArgs(
* medium="MEMORY",
* size_limit="128Mi",
* ),
* )],
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudRunV2.Job("default", new()
* {
* Name = "cloudrun-job",
* Location = "us-central1",
* LaunchStage = "BETA",
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateArgs
* {
* Template = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateContainerVolumeMountArgs
* {
* Name = "empty-dir-volume",
* MountPath = "/mnt",
* },
* },
* },
* },
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeArgs
* {
* Name = "empty-dir-volume",
* EmptyDir = new Gcp.CloudRunV2.Inputs.JobTemplateTemplateVolumeEmptyDirArgs
* {
* Medium = "MEMORY",
* SizeLimit = "128Mi",
* },
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudrunv2.NewJob(ctx, "default", &cloudrunv2.JobArgs{
* Name: pulumi.String("cloudrun-job"),
* Location: pulumi.String("us-central1"),
* LaunchStage: pulumi.String("BETA"),
* Template: &cloudrunv2.JobTemplateArgs{
* Template: &cloudrunv2.JobTemplateTemplateArgs{
* Containers: cloudrunv2.JobTemplateTemplateContainerArray{
* &cloudrunv2.JobTemplateTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* VolumeMounts: cloudrunv2.JobTemplateTemplateContainerVolumeMountArray{
* &cloudrunv2.JobTemplateTemplateContainerVolumeMountArgs{
* Name: pulumi.String("empty-dir-volume"),
* MountPath: pulumi.String("/mnt"),
* },
* },
* },
* },
* Volumes: cloudrunv2.JobTemplateTemplateVolumeArray{
* &cloudrunv2.JobTemplateTemplateVolumeArgs{
* Name: pulumi.String("empty-dir-volume"),
* EmptyDir: &cloudrunv2.JobTemplateTemplateVolumeEmptyDirArgs{
* Medium: pulumi.String("MEMORY"),
* SizeLimit: pulumi.String("128Mi"),
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.cloudrunv2.Job;
* import com.pulumi.gcp.cloudrunv2.JobArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.JobTemplateTemplateArgs;
* 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 default_ = new Job("default", JobArgs.builder()
* .name("cloudrun-job")
* .location("us-central1")
* .launchStage("BETA")
* .template(JobTemplateArgs.builder()
* .template(JobTemplateTemplateArgs.builder()
* .containers(JobTemplateTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .volumeMounts(JobTemplateTemplateContainerVolumeMountArgs.builder()
* .name("empty-dir-volume")
* .mountPath("/mnt")
* .build())
* .build())
* .volumes(JobTemplateTemplateVolumeArgs.builder()
* .name("empty-dir-volume")
* .emptyDir(JobTemplateTemplateVolumeEmptyDirArgs.builder()
* .medium("MEMORY")
* .sizeLimit("128Mi")
* .build())
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Job
* properties:
* name: cloudrun-job
* location: us-central1
* launchStage: BETA
* template:
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* volumeMounts:
* - name: empty-dir-volume
* mountPath: /mnt
* volumes:
* - name: empty-dir-volume
* emptyDir:
* medium: MEMORY
* sizeLimit: 128Mi
* ```
*
* ## Import
* Job can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/jobs/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
* When using the `pulumi import` command, Job can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:cloudrunv2/job:Job default projects/{{project}}/locations/{{location}}/jobs/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudrunv2/job:Job default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudrunv2/job:Job default {{location}}/{{name}}
* ```
*/
public class Job internal constructor(
override val javaResource: com.pulumi.gcp.cloudrunv2.Job,
) : KotlinCustomResource(javaResource, JobMapper) {
/**
* Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and
* should be preserved when modifying objects. Cloud Run API v2 does not support annotations with 'run.googleapis.com',
* 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they will be rejected on new
* resources. All system annotations in v1 now have a corresponding field in v2 Job. This field follows Kubernetes
* annotations' namespacing, limits, and rules. **Note**: This field is non-authoritative, and will only manage the
* annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations
* present on the resource.
*/
public val annotations: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy