Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.cloudrunv2.kotlin.ServiceArgs.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.cloudrunv2.kotlin
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.cloudrunv2.ServiceArgs.builder
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceBinaryAuthorizationArgs
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceBinaryAuthorizationArgsBuilder
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceScalingArgs
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceScalingArgsBuilder
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceTemplateArgs
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceTemplateArgsBuilder
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceTrafficArgs
import com.pulumi.gcp.cloudrunv2.kotlin.inputs.ServiceTrafficArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* Service acts as a top-level container that manages a set of configurations and revision templates which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership.
* To get more information about Service, see:
* * [API documentation](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/run/docs/)
* ## Example Usage
* ### Cloudrunv2 Service Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* ingress: "INGRESS_TRAFFIC_ALL",
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* template={
* "containers": [{
* "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.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Ingress = "INGRESS_TRAFFIC_ALL",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* 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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* 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.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* 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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .ingress("INGRESS_TRAFFIC_ALL")
* .template(ServiceTemplateArgs.builder()
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* ingress: INGRESS_TRAFFIC_ALL
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* ```
*
* ### Cloudrunv2 Service Limits
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* ingress: "INGRESS_TRAFFIC_ALL",
* 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.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* template={
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "resources": {
* "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.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Ingress = "INGRESS_TRAFFIC_ALL",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* Resources = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerResourcesArgs
* {
* 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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* Resources: &cloudrunv2.ServiceTemplateContainerResourcesArgs{
* 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.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* 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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .ingress("INGRESS_TRAFFIC_ALL")
* .template(ServiceTemplateArgs.builder()
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .resources(ServiceTemplateContainerResourcesArgs.builder()
* .limits(Map.ofEntries(
* Map.entry("cpu", "2"),
* Map.entry("memory", "1024Mi")
* ))
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* ingress: INGRESS_TRAFFIC_ALL
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* resources:
* limits:
* cpu: '2'
* memory: 1024Mi
* ```
*
* ### Cloudrunv2 Service Sql
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const secret = new gcp.secretmanager.Secret("secret", {
* secretId: "secret-1",
* replication: {
* auto: {},
* },
* });
* const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
* secret: secret.name,
* secretData: "secret-data",
* });
* 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.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* ingress: "INGRESS_TRAFFIC_ALL",
* template: {
* scaling: {
* maxInstanceCount: 2,
* },
* volumes: [{
* name: "cloudsql",
* cloudSqlInstance: {
* instances: [instance.connectionName],
* },
* }],
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* envs: [
* {
* name: "FOO",
* value: "bar",
* },
* {
* name: "SECRET_ENV_VAR",
* valueSource: {
* secretKeyRef: {
* secret: secret.secretId,
* version: "1",
* },
* },
* },
* ],
* volumeMounts: [{
* name: "cloudsql",
* mountPath: "/cloudsql",
* }],
* }],
* },
* traffics: [{
* type: "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST",
* percent: 100,
* }],
* }, {
* dependsOn: [secret_version_data],
* });
* const project = gcp.organizations.getProject({});
* 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] `),
* }, {
* dependsOn: [secret],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secret = gcp.secretmanager.Secret("secret",
* secret_id="secret-1",
* replication={
* "auto": {},
* })
* secret_version_data = gcp.secretmanager.SecretVersion("secret-version-data",
* secret=secret.name,
* secret_data="secret-data")
* instance = gcp.sql.DatabaseInstance("instance",
* name="cloudrun-sql",
* region="us-central1",
* database_version="MYSQL_5_7",
* settings={
* "tier": "db-f1-micro",
* },
* deletion_protection=True)
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* template={
* "scaling": {
* "max_instance_count": 2,
* },
* "volumes": [{
* "name": "cloudsql",
* "cloud_sql_instance": {
* "instances": [instance.connection_name],
* },
* }],
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "envs": [
* {
* "name": "FOO",
* "value": "bar",
* },
* {
* "name": "SECRET_ENV_VAR",
* "value_source": {
* "secret_key_ref": {
* "secret": secret.secret_id,
* "version": "1",
* },
* },
* },
* ],
* "volume_mounts": [{
* "name": "cloudsql",
* "mount_path": "/cloudsql",
* }],
* }],
* },
* traffics=[{
* "type": "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST",
* "percent": 100,
* }],
* opts = pulumi.ResourceOptions(depends_on=[secret_version_data]))
* project = gcp.organizations.get_project()
* secret_access = gcp.secretmanager.SecretIamMember("secret-access",
* secret_id=secret.id,
* role="roles/secretmanager.secretAccessor",
* member=f"serviceAccount:{project.number}[email protected] ",
* opts = pulumi.ResourceOptions(depends_on=[secret]))
* ```
* ```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-1",
* Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
* {
* Auto = null,
* },
* });
* var secret_version_data = new Gcp.SecretManager.SecretVersion("secret-version-data", new()
* {
* Secret = secret.Name,
* SecretData = "secret-data",
* });
* 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.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Ingress = "INGRESS_TRAFFIC_ALL",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Scaling = new Gcp.CloudRunV2.Inputs.ServiceTemplateScalingArgs
* {
* MaxInstanceCount = 2,
* },
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeArgs
* {
* Name = "cloudsql",
* CloudSqlInstance = new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeCloudSqlInstanceArgs
* {
* Instances = new[]
* {
* instance.ConnectionName,
* },
* },
* },
* },
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* Envs = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerEnvArgs
* {
* Name = "FOO",
* Value = "bar",
* },
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerEnvArgs
* {
* Name = "SECRET_ENV_VAR",
* ValueSource = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerEnvValueSourceArgs
* {
* SecretKeyRef = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerEnvValueSourceSecretKeyRefArgs
* {
* Secret = secret.SecretId,
* Version = "1",
* },
* },
* },
* },
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerVolumeMountArgs
* {
* Name = "cloudsql",
* MountPath = "/cloudsql",
* },
* },
* },
* },
* },
* Traffics = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTrafficArgs
* {
* Type = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST",
* Percent = 100,
* },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* secret_version_data,
* },
* });
* var project = Gcp.Organizations.GetProject.Invoke();
* 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] ",
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* secret,
* },
* });
* });
* ```
* ```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-1"),
* Replication: &secretmanager.SecretReplicationArgs{
* Auto: 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
* }
* 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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Scaling: &cloudrunv2.ServiceTemplateScalingArgs{
* MaxInstanceCount: pulumi.Int(2),
* },
* Volumes: cloudrunv2.ServiceTemplateVolumeArray{
* &cloudrunv2.ServiceTemplateVolumeArgs{
* Name: pulumi.String("cloudsql"),
* CloudSqlInstance: &cloudrunv2.ServiceTemplateVolumeCloudSqlInstanceArgs{
* Instances: pulumi.StringArray{
* instance.ConnectionName,
* },
* },
* },
* },
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* Envs: cloudrunv2.ServiceTemplateContainerEnvArray{
* &cloudrunv2.ServiceTemplateContainerEnvArgs{
* Name: pulumi.String("FOO"),
* Value: pulumi.String("bar"),
* },
* &cloudrunv2.ServiceTemplateContainerEnvArgs{
* Name: pulumi.String("SECRET_ENV_VAR"),
* ValueSource: &cloudrunv2.ServiceTemplateContainerEnvValueSourceArgs{
* SecretKeyRef: &cloudrunv2.ServiceTemplateContainerEnvValueSourceSecretKeyRefArgs{
* Secret: secret.SecretId,
* Version: pulumi.String("1"),
* },
* },
* },
* },
* VolumeMounts: cloudrunv2.ServiceTemplateContainerVolumeMountArray{
* &cloudrunv2.ServiceTemplateContainerVolumeMountArgs{
* Name: pulumi.String("cloudsql"),
* MountPath: pulumi.String("/cloudsql"),
* },
* },
* },
* },
* },
* Traffics: cloudrunv2.ServiceTrafficArray{
* &cloudrunv2.ServiceTrafficArgs{
* Type: pulumi.String("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"),
* Percent: pulumi.Int(100),
* },
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* secret_version_data,
* }))
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretIamMember(ctx, "secret-access", &secretmanager.SecretIamMemberArgs{
* SecretId: secret.ID(),
* Role: pulumi.String("roles/secretmanager.secretAccessor"),
* Member: pulumi.Sprintf("serviceAccount:%[email protected] ", project.Number),
* }, pulumi.DependsOn([]pulumi.Resource{
* secret,
* }))
* 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.secretmanager.SecretVersion;
* import com.pulumi.gcp.secretmanager.SecretVersionArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.cloudrunv2.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateScalingArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTrafficArgs;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.secretmanager.SecretIamMember;
* import com.pulumi.gcp.secretmanager.SecretIamMemberArgs;
* import com.pulumi.resources.CustomResourceOptions;
* 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-1")
* .replication(SecretReplicationArgs.builder()
* .auto()
* .build())
* .build());
* var secret_version_data = new SecretVersion("secret-version-data", SecretVersionArgs.builder()
* .secret(secret.name())
* .secretData("secret-data")
* .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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .ingress("INGRESS_TRAFFIC_ALL")
* .template(ServiceTemplateArgs.builder()
* .scaling(ServiceTemplateScalingArgs.builder()
* .maxInstanceCount(2)
* .build())
* .volumes(ServiceTemplateVolumeArgs.builder()
* .name("cloudsql")
* .cloudSqlInstance(ServiceTemplateVolumeCloudSqlInstanceArgs.builder()
* .instances(instance.connectionName())
* .build())
* .build())
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .envs(
* ServiceTemplateContainerEnvArgs.builder()
* .name("FOO")
* .value("bar")
* .build(),
* ServiceTemplateContainerEnvArgs.builder()
* .name("SECRET_ENV_VAR")
* .valueSource(ServiceTemplateContainerEnvValueSourceArgs.builder()
* .secretKeyRef(ServiceTemplateContainerEnvValueSourceSecretKeyRefArgs.builder()
* .secret(secret.secretId())
* .version("1")
* .build())
* .build())
* .build())
* .volumeMounts(ServiceTemplateContainerVolumeMountArgs.builder()
* .name("cloudsql")
* .mountPath("/cloudsql")
* .build())
* .build())
* .build())
* .traffics(ServiceTrafficArgs.builder()
* .type("TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST")
* .percent(100)
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(secret_version_data)
* .build());
* final var project = OrganizationsFunctions.getProject();
* 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(), CustomResourceOptions.builder()
* .dependsOn(secret)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* ingress: INGRESS_TRAFFIC_ALL
* template:
* scaling:
* maxInstanceCount: 2
* volumes:
* - name: cloudsql
* cloudSqlInstance:
* instances:
* - ${instance.connectionName}
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* envs:
* - name: FOO
* value: bar
* - name: SECRET_ENV_VAR
* valueSource:
* secretKeyRef:
* secret: ${secret.secretId}
* version: '1'
* volumeMounts:
* - name: cloudsql
* mountPath: /cloudsql
* traffics:
* - type: TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST
* percent: 100
* options:
* dependson:
* - ${["secret-version-data"]}
* secret:
* type: gcp:secretmanager:Secret
* properties:
* secretId: secret-1
* 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]
* options:
* dependson:
* - ${secret}
* 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 Service 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.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* 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={
* "name": custom_test.name,
* },
* machine_type="e2-standard-4",
* min_instances=2,
* max_instances=3,
* region="us-central1")
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* template={
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* "vpc_access": {
* "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.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* },
* },
* VpcAccess = new Gcp.CloudRunV2.Inputs.ServiceTemplateVpcAccessArgs
* {
* 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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* },
* },
* VpcAccess: &cloudrunv2.ServiceTemplateVpcAccessArgs{
* 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.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateVpcAccessArgs;
* 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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .template(ServiceTemplateArgs.builder()
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .build())
* .vpcAccess(ServiceTemplateVpcAccessArgs.builder()
* .connector(connector.id())
* .egress("ALL_TRAFFIC")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* 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 Service Directvpc
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* launchStage: "GA",
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* vpcAccess: {
* networkInterfaces: [{
* network: "default",
* subnetwork: "default",
* tags: [
* "tag1",
* "tag2",
* "tag3",
* ],
* }],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* launch_stage="GA",
* template={
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* "vpc_access": {
* "network_interfaces": [{
* "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.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* LaunchStage = "GA",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* },
* },
* VpcAccess = new Gcp.CloudRunV2.Inputs.ServiceTemplateVpcAccessArgs
* {
* NetworkInterfaces = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVpcAccessNetworkInterfaceArgs
* {
* 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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* LaunchStage: pulumi.String("GA"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* },
* },
* VpcAccess: &cloudrunv2.ServiceTemplateVpcAccessArgs{
* NetworkInterfaces: cloudrunv2.ServiceTemplateVpcAccessNetworkInterfaceArray{
* &cloudrunv2.ServiceTemplateVpcAccessNetworkInterfaceArgs{
* 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.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateVpcAccessArgs;
* 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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .launchStage("GA")
* .template(ServiceTemplateArgs.builder()
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .build())
* .vpcAccess(ServiceTemplateVpcAccessArgs.builder()
* .networkInterfaces(ServiceTemplateVpcAccessNetworkInterfaceArgs.builder()
* .network("default")
* .subnetwork("default")
* .tags(
* "tag1",
* "tag2",
* "tag3")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* launchStage: GA
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* vpcAccess:
* networkInterfaces:
* - network: default
* subnetwork: default
* tags:
* - tag1
* - tag2
* - tag3
* ```
*
* ### Cloudrunv2 Service Probes
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* startupProbe: {
* initialDelaySeconds: 0,
* timeoutSeconds: 1,
* periodSeconds: 3,
* failureThreshold: 1,
* tcpSocket: {
* port: 8080,
* },
* },
* livenessProbe: {
* httpGet: {
* path: "/",
* },
* },
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* template={
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "startup_probe": {
* "initial_delay_seconds": 0,
* "timeout_seconds": 1,
* "period_seconds": 3,
* "failure_threshold": 1,
* "tcp_socket": {
* "port": 8080,
* },
* },
* "liveness_probe": {
* "http_get": {
* "path": "/",
* },
* },
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudRunV2.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* StartupProbe = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerStartupProbeArgs
* {
* InitialDelaySeconds = 0,
* TimeoutSeconds = 1,
* PeriodSeconds = 3,
* FailureThreshold = 1,
* TcpSocket = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerStartupProbeTcpSocketArgs
* {
* Port = 8080,
* },
* },
* LivenessProbe = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerLivenessProbeArgs
* {
* HttpGet = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerLivenessProbeHttpGetArgs
* {
* Path = "/",
* },
* },
* },
* },
* },
* });
* });
* ```
* ```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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* StartupProbe: &cloudrunv2.ServiceTemplateContainerStartupProbeArgs{
* InitialDelaySeconds: pulumi.Int(0),
* TimeoutSeconds: pulumi.Int(1),
* PeriodSeconds: pulumi.Int(3),
* FailureThreshold: pulumi.Int(1),
* TcpSocket: &cloudrunv2.ServiceTemplateContainerStartupProbeTcpSocketArgs{
* Port: pulumi.Int(8080),
* },
* },
* LivenessProbe: &cloudrunv2.ServiceTemplateContainerLivenessProbeArgs{
* HttpGet: &cloudrunv2.ServiceTemplateContainerLivenessProbeHttpGetArgs{
* Path: pulumi.String("/"),
* },
* },
* },
* },
* },
* })
* 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.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* 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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .template(ServiceTemplateArgs.builder()
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .startupProbe(ServiceTemplateContainerStartupProbeArgs.builder()
* .initialDelaySeconds(0)
* .timeoutSeconds(1)
* .periodSeconds(3)
* .failureThreshold(1)
* .tcpSocket(ServiceTemplateContainerStartupProbeTcpSocketArgs.builder()
* .port(8080)
* .build())
* .build())
* .livenessProbe(ServiceTemplateContainerLivenessProbeArgs.builder()
* .httpGet(ServiceTemplateContainerLivenessProbeHttpGetArgs.builder()
* .path("/")
* .build())
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* template:
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* startupProbe:
* initialDelaySeconds: 0
* timeoutSeconds: 1
* periodSeconds: 3
* failureThreshold: 1
* tcpSocket:
* port: 8080
* livenessProbe:
* httpGet:
* path: /
* ```
*
* ### Cloudrunv2 Service Secret
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const secret = new gcp.secretmanager.Secret("secret", {
* secretId: "secret-1",
* replication: {
* auto: {},
* },
* });
* const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
* secret: secret.name,
* secretData: "secret-data",
* });
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* ingress: "INGRESS_TRAFFIC_ALL",
* template: {
* volumes: [{
* name: "a-volume",
* secret: {
* secret: secret.secretId,
* defaultMode: 292,
* items: [{
* version: "1",
* path: "my-secret",
* }],
* },
* }],
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* volumeMounts: [{
* name: "a-volume",
* mountPath: "/secrets",
* }],
* }],
* },
* }, {
* dependsOn: [secret_version_data],
* });
* const project = gcp.organizations.getProject({});
* 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] `),
* }, {
* dependsOn: [secret],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secret = gcp.secretmanager.Secret("secret",
* secret_id="secret-1",
* replication={
* "auto": {},
* })
* secret_version_data = gcp.secretmanager.SecretVersion("secret-version-data",
* secret=secret.name,
* secret_data="secret-data")
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* template={
* "volumes": [{
* "name": "a-volume",
* "secret": {
* "secret": secret.secret_id,
* "default_mode": 292,
* "items": [{
* "version": "1",
* "path": "my-secret",
* }],
* },
* }],
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "volume_mounts": [{
* "name": "a-volume",
* "mount_path": "/secrets",
* }],
* }],
* },
* opts = pulumi.ResourceOptions(depends_on=[secret_version_data]))
* project = gcp.organizations.get_project()
* secret_access = gcp.secretmanager.SecretIamMember("secret-access",
* secret_id=secret.id,
* role="roles/secretmanager.secretAccessor",
* member=f"serviceAccount:{project.number}[email protected] ",
* opts = pulumi.ResourceOptions(depends_on=[secret]))
* ```
* ```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-1",
* Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
* {
* Auto = null,
* },
* });
* var secret_version_data = new Gcp.SecretManager.SecretVersion("secret-version-data", new()
* {
* Secret = secret.Name,
* SecretData = "secret-data",
* });
* var @default = new Gcp.CloudRunV2.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Ingress = "INGRESS_TRAFFIC_ALL",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeArgs
* {
* Name = "a-volume",
* Secret = new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeSecretArgs
* {
* Secret = secret.SecretId,
* DefaultMode = 292,
* Items = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeSecretItemArgs
* {
* Version = "1",
* Path = "my-secret",
* },
* },
* },
* },
* },
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerVolumeMountArgs
* {
* Name = "a-volume",
* MountPath = "/secrets",
* },
* },
* },
* },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* secret_version_data,
* },
* });
* var project = Gcp.Organizations.GetProject.Invoke();
* 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] ",
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* secret,
* },
* });
* });
* ```
* ```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-1"),
* Replication: &secretmanager.SecretReplicationArgs{
* Auto: 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 = cloudrunv2.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Volumes: cloudrunv2.ServiceTemplateVolumeArray{
* &cloudrunv2.ServiceTemplateVolumeArgs{
* Name: pulumi.String("a-volume"),
* Secret: &cloudrunv2.ServiceTemplateVolumeSecretArgs{
* Secret: secret.SecretId,
* DefaultMode: pulumi.Int(292),
* Items: cloudrunv2.ServiceTemplateVolumeSecretItemArray{
* &cloudrunv2.ServiceTemplateVolumeSecretItemArgs{
* Version: pulumi.String("1"),
* Path: pulumi.String("my-secret"),
* },
* },
* },
* },
* },
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* VolumeMounts: cloudrunv2.ServiceTemplateContainerVolumeMountArray{
* &cloudrunv2.ServiceTemplateContainerVolumeMountArgs{
* Name: pulumi.String("a-volume"),
* MountPath: pulumi.String("/secrets"),
* },
* },
* },
* },
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* secret_version_data,
* }))
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretIamMember(ctx, "secret-access", &secretmanager.SecretIamMemberArgs{
* SecretId: secret.ID(),
* Role: pulumi.String("roles/secretmanager.secretAccessor"),
* Member: pulumi.Sprintf("serviceAccount:%[email protected] ", project.Number),
* }, pulumi.DependsOn([]pulumi.Resource{
* secret,
* }))
* 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.secretmanager.SecretVersion;
* import com.pulumi.gcp.secretmanager.SecretVersionArgs;
* import com.pulumi.gcp.cloudrunv2.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.secretmanager.SecretIamMember;
* import com.pulumi.gcp.secretmanager.SecretIamMemberArgs;
* import com.pulumi.resources.CustomResourceOptions;
* 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-1")
* .replication(SecretReplicationArgs.builder()
* .auto()
* .build())
* .build());
* var secret_version_data = new SecretVersion("secret-version-data", SecretVersionArgs.builder()
* .secret(secret.name())
* .secretData("secret-data")
* .build());
* var default_ = new Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .ingress("INGRESS_TRAFFIC_ALL")
* .template(ServiceTemplateArgs.builder()
* .volumes(ServiceTemplateVolumeArgs.builder()
* .name("a-volume")
* .secret(ServiceTemplateVolumeSecretArgs.builder()
* .secret(secret.secretId())
* .defaultMode(292)
* .items(ServiceTemplateVolumeSecretItemArgs.builder()
* .version("1")
* .path("my-secret")
* .build())
* .build())
* .build())
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .volumeMounts(ServiceTemplateContainerVolumeMountArgs.builder()
* .name("a-volume")
* .mountPath("/secrets")
* .build())
* .build())
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(secret_version_data)
* .build());
* final var project = OrganizationsFunctions.getProject();
* 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(), CustomResourceOptions.builder()
* .dependsOn(secret)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* ingress: INGRESS_TRAFFIC_ALL
* template:
* volumes:
* - name: a-volume
* secret:
* secret: ${secret.secretId}
* defaultMode: 292
* items:
* - version: '1'
* path: my-secret
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* volumeMounts:
* - name: a-volume
* mountPath: /secrets
* options:
* dependson:
* - ${["secret-version-data"]}
* secret:
* type: gcp:secretmanager:Secret
* properties:
* secretId: secret-1
* 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]
* options:
* dependson:
* - ${secret}
* variables:
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* ```
*
* ### Cloudrunv2 Service Multicontainer
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* launchStage: "BETA",
* ingress: "INGRESS_TRAFFIC_ALL",
* template: {
* containers: [
* {
* name: "hello-1",
* ports: {
* containerPort: 8080,
* },
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* dependsOns: ["hello-2"],
* volumeMounts: [{
* name: "empty-dir-volume",
* mountPath: "/mnt",
* }],
* },
* {
* name: "hello-2",
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* envs: [{
* name: "PORT",
* value: "8081",
* }],
* startupProbe: {
* httpGet: {
* port: 8081,
* },
* },
* },
* ],
* volumes: [{
* name: "empty-dir-volume",
* emptyDir: {
* medium: "MEMORY",
* sizeLimit: "256Mi",
* },
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* launch_stage="BETA",
* ingress="INGRESS_TRAFFIC_ALL",
* template={
* "containers": [
* {
* "name": "hello-1",
* "ports": {
* "container_port": 8080,
* },
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "depends_ons": ["hello-2"],
* "volume_mounts": [{
* "name": "empty-dir-volume",
* "mount_path": "/mnt",
* }],
* },
* {
* "name": "hello-2",
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "envs": [{
* "name": "PORT",
* "value": "8081",
* }],
* "startup_probe": {
* "http_get": {
* "port": 8081,
* },
* },
* },
* ],
* "volumes": [{
* "name": "empty-dir-volume",
* "empty_dir": {
* "medium": "MEMORY",
* "size_limit": "256Mi",
* },
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.CloudRunV2.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* LaunchStage = "BETA",
* Ingress = "INGRESS_TRAFFIC_ALL",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Name = "hello-1",
* Ports =
* {
* { "containerPort", 8080 },
* },
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* DependsOns = new[]
* {
* "hello-2",
* },
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerVolumeMountArgs
* {
* Name = "empty-dir-volume",
* MountPath = "/mnt",
* },
* },
* },
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Name = "hello-2",
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* Envs = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerEnvArgs
* {
* Name = "PORT",
* Value = "8081",
* },
* },
* StartupProbe = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerStartupProbeArgs
* {
* HttpGet = new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerStartupProbeHttpGetArgs
* {
* Port = 8081,
* },
* },
* },
* },
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeArgs
* {
* Name = "empty-dir-volume",
* EmptyDir = new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeEmptyDirArgs
* {
* Medium = "MEMORY",
* SizeLimit = "256Mi",
* },
* },
* },
* },
* });
* });
* ```
* ```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.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* LaunchStage: pulumi.String("BETA"),
* Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Name: pulumi.String("hello-1"),
* Ports: cloudrunv2.ServiceTemplateContainerPortArray{
* ContainerPort: 8080,
* },
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* DependsOns: pulumi.StringArray{
* pulumi.String("hello-2"),
* },
* VolumeMounts: cloudrunv2.ServiceTemplateContainerVolumeMountArray{
* &cloudrunv2.ServiceTemplateContainerVolumeMountArgs{
* Name: pulumi.String("empty-dir-volume"),
* MountPath: pulumi.String("/mnt"),
* },
* },
* },
* &cloudrunv2.ServiceTemplateContainerArgs{
* Name: pulumi.String("hello-2"),
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* Envs: cloudrunv2.ServiceTemplateContainerEnvArray{
* &cloudrunv2.ServiceTemplateContainerEnvArgs{
* Name: pulumi.String("PORT"),
* Value: pulumi.String("8081"),
* },
* },
* StartupProbe: &cloudrunv2.ServiceTemplateContainerStartupProbeArgs{
* HttpGet: &cloudrunv2.ServiceTemplateContainerStartupProbeHttpGetArgs{
* Port: pulumi.Int(8081),
* },
* },
* },
* },
* Volumes: cloudrunv2.ServiceTemplateVolumeArray{
* &cloudrunv2.ServiceTemplateVolumeArgs{
* Name: pulumi.String("empty-dir-volume"),
* EmptyDir: &cloudrunv2.ServiceTemplateVolumeEmptyDirArgs{
* Medium: pulumi.String("MEMORY"),
* SizeLimit: pulumi.String("256Mi"),
* },
* },
* },
* },
* })
* 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.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* 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 Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .launchStage("BETA")
* .ingress("INGRESS_TRAFFIC_ALL")
* .template(ServiceTemplateArgs.builder()
* .containers(
* ServiceTemplateContainerArgs.builder()
* .name("hello-1")
* .ports(ServiceTemplateContainerPortArgs.builder()
* .containerPort(8080)
* .build())
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .dependsOns("hello-2")
* .volumeMounts(ServiceTemplateContainerVolumeMountArgs.builder()
* .name("empty-dir-volume")
* .mountPath("/mnt")
* .build())
* .build(),
* ServiceTemplateContainerArgs.builder()
* .name("hello-2")
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .envs(ServiceTemplateContainerEnvArgs.builder()
* .name("PORT")
* .value("8081")
* .build())
* .startupProbe(ServiceTemplateContainerStartupProbeArgs.builder()
* .httpGet(ServiceTemplateContainerStartupProbeHttpGetArgs.builder()
* .port(8081)
* .build())
* .build())
* .build())
* .volumes(ServiceTemplateVolumeArgs.builder()
* .name("empty-dir-volume")
* .emptyDir(ServiceTemplateVolumeEmptyDirArgs.builder()
* .medium("MEMORY")
* .sizeLimit("256Mi")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* launchStage: BETA
* ingress: INGRESS_TRAFFIC_ALL
* template:
* containers:
* - name: hello-1
* ports:
* containerPort: 8080
* image: us-docker.pkg.dev/cloudrun/container/hello
* dependsOns:
* - hello-2
* volumeMounts:
* - name: empty-dir-volume
* mountPath: /mnt
* - name: hello-2
* image: us-docker.pkg.dev/cloudrun/container/hello
* envs:
* - name: PORT
* value: '8081'
* startupProbe:
* httpGet:
* port: 8081
* volumes:
* - name: empty-dir-volume
* emptyDir:
* medium: MEMORY
* sizeLimit: 256Mi
* ```
*
* ### Cloudrunv2 Service Mount Gcs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const defaultBucket = new gcp.storage.Bucket("default", {
* name: "cloudrun-service",
* location: "US",
* });
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* launchStage: "BETA",
* template: {
* executionEnvironment: "EXECUTION_ENVIRONMENT_GEN2",
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* volumeMounts: [{
* name: "bucket",
* mountPath: "/var/www",
* }],
* }],
* volumes: [{
* name: "bucket",
* gcs: {
* bucket: defaultBucket.name,
* readOnly: false,
* },
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default_bucket = gcp.storage.Bucket("default",
* name="cloudrun-service",
* location="US")
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* launch_stage="BETA",
* template={
* "execution_environment": "EXECUTION_ENVIRONMENT_GEN2",
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello",
* "volume_mounts": [{
* "name": "bucket",
* "mount_path": "/var/www",
* }],
* }],
* "volumes": [{
* "name": "bucket",
* "gcs": {
* "bucket": default_bucket.name,
* "read_only": False,
* },
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var defaultBucket = new Gcp.Storage.Bucket("default", new()
* {
* Name = "cloudrun-service",
* Location = "US",
* });
* var @default = new Gcp.CloudRunV2.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* LaunchStage = "BETA",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* ExecutionEnvironment = "EXECUTION_ENVIRONMENT_GEN2",
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello",
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerVolumeMountArgs
* {
* Name = "bucket",
* MountPath = "/var/www",
* },
* },
* },
* },
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeArgs
* {
* Name = "bucket",
* Gcs = new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeGcsArgs
* {
* Bucket = defaultBucket.Name,
* ReadOnly = false,
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* defaultBucket, err := storage.NewBucket(ctx, "default", &storage.BucketArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("US"),
* })
* if err != nil {
* return err
* }
* _, err = cloudrunv2.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* LaunchStage: pulumi.String("BETA"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* ExecutionEnvironment: pulumi.String("EXECUTION_ENVIRONMENT_GEN2"),
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
* VolumeMounts: cloudrunv2.ServiceTemplateContainerVolumeMountArray{
* &cloudrunv2.ServiceTemplateContainerVolumeMountArgs{
* Name: pulumi.String("bucket"),
* MountPath: pulumi.String("/var/www"),
* },
* },
* },
* },
* Volumes: cloudrunv2.ServiceTemplateVolumeArray{
* &cloudrunv2.ServiceTemplateVolumeArgs{
* Name: pulumi.String("bucket"),
* Gcs: &cloudrunv2.ServiceTemplateVolumeGcsArgs{
* Bucket: defaultBucket.Name,
* ReadOnly: pulumi.Bool(false),
* },
* },
* },
* },
* })
* 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.storage.Bucket;
* import com.pulumi.gcp.storage.BucketArgs;
* import com.pulumi.gcp.cloudrunv2.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* 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 defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
* .name("cloudrun-service")
* .location("US")
* .build());
* var default_ = new Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .launchStage("BETA")
* .template(ServiceTemplateArgs.builder()
* .executionEnvironment("EXECUTION_ENVIRONMENT_GEN2")
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello")
* .volumeMounts(ServiceTemplateContainerVolumeMountArgs.builder()
* .name("bucket")
* .mountPath("/var/www")
* .build())
* .build())
* .volumes(ServiceTemplateVolumeArgs.builder()
* .name("bucket")
* .gcs(ServiceTemplateVolumeGcsArgs.builder()
* .bucket(defaultBucket.name())
* .readOnly(false)
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* launchStage: BETA
* template:
* executionEnvironment: EXECUTION_ENVIRONMENT_GEN2
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello
* volumeMounts:
* - name: bucket
* mountPath: /var/www
* volumes:
* - name: bucket
* gcs:
* bucket: ${defaultBucket.name}
* readOnly: false
* defaultBucket:
* type: gcp:storage:Bucket
* name: default
* properties:
* name: cloudrun-service
* location: US
* ```
*
* ### Cloudrunv2 Service Mount Nfs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const defaultInstance = new gcp.filestore.Instance("default", {
* name: "cloudrun-service",
* location: "us-central1-b",
* tier: "BASIC_HDD",
* fileShares: {
* capacityGb: 1024,
* name: "share1",
* },
* networks: [{
* network: "default",
* modes: ["MODE_IPV4"],
* }],
* });
* const _default = new gcp.cloudrunv2.Service("default", {
* name: "cloudrun-service",
* location: "us-central1",
* ingress: "INGRESS_TRAFFIC_ALL",
* launchStage: "BETA",
* template: {
* executionEnvironment: "EXECUTION_ENVIRONMENT_GEN2",
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello:latest",
* volumeMounts: [{
* name: "nfs",
* mountPath: "/mnt/nfs/filestore",
* }],
* }],
* vpcAccess: {
* networkInterfaces: [{
* network: "default",
* subnetwork: "default",
* }],
* },
* volumes: [{
* name: "nfs",
* nfs: {
* server: defaultInstance.networks.apply(networks => networks[0].ipAddresses?.[0]),
* path: "/share1",
* readOnly: false,
* },
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default_instance = gcp.filestore.Instance("default",
* name="cloudrun-service",
* location="us-central1-b",
* tier="BASIC_HDD",
* file_shares={
* "capacity_gb": 1024,
* "name": "share1",
* },
* networks=[{
* "network": "default",
* "modes": ["MODE_IPV4"],
* }])
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* launch_stage="BETA",
* template={
* "execution_environment": "EXECUTION_ENVIRONMENT_GEN2",
* "containers": [{
* "image": "us-docker.pkg.dev/cloudrun/container/hello:latest",
* "volume_mounts": [{
* "name": "nfs",
* "mount_path": "/mnt/nfs/filestore",
* }],
* }],
* "vpc_access": {
* "network_interfaces": [{
* "network": "default",
* "subnetwork": "default",
* }],
* },
* "volumes": [{
* "name": "nfs",
* "nfs": {
* "server": default_instance.networks[0].ip_addresses[0],
* "path": "/share1",
* "read_only": False,
* },
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var defaultInstance = new Gcp.Filestore.Instance("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1-b",
* Tier = "BASIC_HDD",
* FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
* {
* CapacityGb = 1024,
* Name = "share1",
* },
* Networks = new[]
* {
* new Gcp.Filestore.Inputs.InstanceNetworkArgs
* {
* Network = "default",
* Modes = new[]
* {
* "MODE_IPV4",
* },
* },
* },
* });
* var @default = new Gcp.CloudRunV2.Service("default", new()
* {
* Name = "cloudrun-service",
* Location = "us-central1",
* Ingress = "INGRESS_TRAFFIC_ALL",
* LaunchStage = "BETA",
* Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
* {
* ExecutionEnvironment = "EXECUTION_ENVIRONMENT_GEN2",
* Containers = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
* {
* Image = "us-docker.pkg.dev/cloudrun/container/hello:latest",
* VolumeMounts = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerVolumeMountArgs
* {
* Name = "nfs",
* MountPath = "/mnt/nfs/filestore",
* },
* },
* },
* },
* VpcAccess = new Gcp.CloudRunV2.Inputs.ServiceTemplateVpcAccessArgs
* {
* NetworkInterfaces = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVpcAccessNetworkInterfaceArgs
* {
* Network = "default",
* Subnetwork = "default",
* },
* },
* },
* Volumes = new[]
* {
* new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeArgs
* {
* Name = "nfs",
* Nfs = new Gcp.CloudRunV2.Inputs.ServiceTemplateVolumeNfsArgs
* {
* Server = defaultInstance.Networks.Apply(networks => networks[0].IpAddresses[0]),
* Path = "/share1",
* ReadOnly = false,
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* defaultInstance, err := filestore.NewInstance(ctx, "default", &filestore.InstanceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1-b"),
* Tier: pulumi.String("BASIC_HDD"),
* FileShares: &filestore.InstanceFileSharesArgs{
* CapacityGb: pulumi.Int(1024),
* Name: pulumi.String("share1"),
* },
* Networks: filestore.InstanceNetworkArray{
* &filestore.InstanceNetworkArgs{
* Network: pulumi.String("default"),
* Modes: pulumi.StringArray{
* pulumi.String("MODE_IPV4"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = cloudrunv2.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
* Name: pulumi.String("cloudrun-service"),
* Location: pulumi.String("us-central1"),
* Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
* LaunchStage: pulumi.String("BETA"),
* Template: &cloudrunv2.ServiceTemplateArgs{
* ExecutionEnvironment: pulumi.String("EXECUTION_ENVIRONMENT_GEN2"),
* Containers: cloudrunv2.ServiceTemplateContainerArray{
* &cloudrunv2.ServiceTemplateContainerArgs{
* Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello:latest"),
* VolumeMounts: cloudrunv2.ServiceTemplateContainerVolumeMountArray{
* &cloudrunv2.ServiceTemplateContainerVolumeMountArgs{
* Name: pulumi.String("nfs"),
* MountPath: pulumi.String("/mnt/nfs/filestore"),
* },
* },
* },
* },
* VpcAccess: &cloudrunv2.ServiceTemplateVpcAccessArgs{
* NetworkInterfaces: cloudrunv2.ServiceTemplateVpcAccessNetworkInterfaceArray{
* &cloudrunv2.ServiceTemplateVpcAccessNetworkInterfaceArgs{
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* },
* },
* },
* Volumes: cloudrunv2.ServiceTemplateVolumeArray{
* &cloudrunv2.ServiceTemplateVolumeArgs{
* Name: pulumi.String("nfs"),
* Nfs: &cloudrunv2.ServiceTemplateVolumeNfsArgs{
* Server: defaultInstance.Networks.ApplyT(func(networks []filestore.InstanceNetwork) (*string, error) {
* return &networks[0].IpAddresses[0], nil
* }).(pulumi.StringPtrOutput),
* Path: pulumi.String("/share1"),
* ReadOnly: pulumi.Bool(false),
* },
* },
* },
* },
* })
* 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.filestore.Instance;
* import com.pulumi.gcp.filestore.InstanceArgs;
* import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
* import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
* import com.pulumi.gcp.cloudrunv2.Service;
* import com.pulumi.gcp.cloudrunv2.ServiceArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
* import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateVpcAccessArgs;
* 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 defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1-b")
* .tier("BASIC_HDD")
* .fileShares(InstanceFileSharesArgs.builder()
* .capacityGb(1024)
* .name("share1")
* .build())
* .networks(InstanceNetworkArgs.builder()
* .network("default")
* .modes("MODE_IPV4")
* .build())
* .build());
* var default_ = new Service("default", ServiceArgs.builder()
* .name("cloudrun-service")
* .location("us-central1")
* .ingress("INGRESS_TRAFFIC_ALL")
* .launchStage("BETA")
* .template(ServiceTemplateArgs.builder()
* .executionEnvironment("EXECUTION_ENVIRONMENT_GEN2")
* .containers(ServiceTemplateContainerArgs.builder()
* .image("us-docker.pkg.dev/cloudrun/container/hello:latest")
* .volumeMounts(ServiceTemplateContainerVolumeMountArgs.builder()
* .name("nfs")
* .mountPath("/mnt/nfs/filestore")
* .build())
* .build())
* .vpcAccess(ServiceTemplateVpcAccessArgs.builder()
* .networkInterfaces(ServiceTemplateVpcAccessNetworkInterfaceArgs.builder()
* .network("default")
* .subnetwork("default")
* .build())
* .build())
* .volumes(ServiceTemplateVolumeArgs.builder()
* .name("nfs")
* .nfs(ServiceTemplateVolumeNfsArgs.builder()
* .server(defaultInstance.networks().applyValue(networks -> networks[0].ipAddresses()[0]))
* .path("/share1")
* .readOnly(false)
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2:Service
* properties:
* name: cloudrun-service
* location: us-central1
* ingress: INGRESS_TRAFFIC_ALL
* launchStage: BETA
* template:
* executionEnvironment: EXECUTION_ENVIRONMENT_GEN2
* containers:
* - image: us-docker.pkg.dev/cloudrun/container/hello:latest
* volumeMounts:
* - name: nfs
* mountPath: /mnt/nfs/filestore
* vpcAccess:
* networkInterfaces:
* - network: default
* subnetwork: default
* volumes:
* - name: nfs
* nfs:
* server: ${defaultInstance.networks[0].ipAddresses[0]}
* path: /share1
* readOnly: false
* defaultInstance:
* type: gcp:filestore:Instance
* name: default
* properties:
* name: cloudrun-service
* location: us-central1-b
* tier: BASIC_HDD
* fileShares:
* capacityGb: 1024
* name: share1
* networks:
* - network: default
* modes:
* - MODE_IPV4
* ```
*
* ## Import
* Service can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/services/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
* When using the `pulumi import` command, Service can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:cloudrunv2/service:Service default projects/{{project}}/locations/{{location}}/services/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudrunv2/service:Service default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudrunv2/service:Service default {{location}}/{{name}}
* ```
* @property annotations 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 in new
* resources. All system annotations in v1 now have a corresponding field in v2 Service. 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.
* @property binaryAuthorization Settings for the Binary Authorization feature.
* @property client Arbitrary identifier for the API client.
* @property clientVersion Arbitrary version identifier for the API client.
* @property customAudiences One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a
* string. The custom audiences are encoded in the token and used to authenticate requests. For more information, see
* https://cloud.google.com/run/docs/configuring/custom-audiences.
* @property defaultUriDisabled Disables public resolution of the default URI of this service.
* @property description User-provided description of the Service. This field currently has a 512-character limit.
* @property ingress Provides the ingress settings for this Service. On output, returns the currently observed ingress settings, or
* INGRESS_TRAFFIC_UNSPECIFIED if no revision is active. Possible values: ["INGRESS_TRAFFIC_ALL",
* "INGRESS_TRAFFIC_INTERNAL_ONLY", "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"]
* @property labels Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with
* Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment,
* state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or
* https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with
* 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they
* will be rejected. All system labels in v1 now have a corresponding field in v2 Service. **Note**: This field is
* non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
* 'effective_labels' for all of the labels present on the resource.
* @property launchStage The launch stage as defined by [Google Cloud Platform Launch
* Stages](https://cloud.google.com/products#product-launch-stages). Cloud Run supports ALPHA, BETA, and GA. If no value is
* specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that
* stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as
* input, but only BETA and GA-level features are used, this field will be BETA on output. Possible values:
* ["UNIMPLEMENTED", "PRELAUNCH", "EARLY_ACCESS", "ALPHA", "BETA", "GA", "DEPRECATED"]
* @property location The location of the cloud run service
* @property name Name of the Service.
* @property project
* @property scaling Scaling settings that apply to the whole service
* @property template The template used to create revisions for this Service.
* Structure is documented below.
* @property traffics Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
public data class ServiceArgs(
public val annotations: Output>? = null,
public val binaryAuthorization: Output? = null,
public val client: Output? = null,
public val clientVersion: Output? = null,
public val customAudiences: Output>? = null,
public val defaultUriDisabled: Output? = null,
public val description: Output? = null,
public val ingress: Output? = null,
public val labels: Output>? = null,
public val launchStage: Output? = null,
public val location: Output? = null,
public val name: Output? = null,
public val project: Output? = null,
public val scaling: Output? = null,
public val template: Output? = null,
public val traffics: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gcp.cloudrunv2.ServiceArgs =
com.pulumi.gcp.cloudrunv2.ServiceArgs.builder()
.annotations(
annotations?.applyValue({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}),
)
.binaryAuthorization(
binaryAuthorization?.applyValue({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
}),
)
.client(client?.applyValue({ args0 -> args0 }))
.clientVersion(clientVersion?.applyValue({ args0 -> args0 }))
.customAudiences(customAudiences?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.defaultUriDisabled(defaultUriDisabled?.applyValue({ args0 -> args0 }))
.description(description?.applyValue({ args0 -> args0 }))
.ingress(ingress?.applyValue({ args0 -> args0 }))
.labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
.launchStage(launchStage?.applyValue({ args0 -> args0 }))
.location(location?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.scaling(scaling?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.template(template?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.traffics(
traffics?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
).build()
}
/**
* Builder for [ServiceArgs].
*/
@PulumiTagMarker
public class ServiceArgsBuilder internal constructor() {
private var annotations: Output>? = null
private var binaryAuthorization: Output? = null
private var client: Output? = null
private var clientVersion: Output? = null
private var customAudiences: Output>? = null
private var defaultUriDisabled: Output? = null
private var description: Output? = null
private var ingress: Output? = null
private var labels: Output>? = null
private var launchStage: Output? = null
private var location: Output? = null
private var name: Output? = null
private var project: Output? = null
private var scaling: Output? = null
private var template: Output? = null
private var traffics: Output>? = null
/**
* @param value 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 in new
* resources. All system annotations in v1 now have a corresponding field in v2 Service. 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.
*/
@JvmName("tmkylqwjkmblfvtm")
public suspend fun annotations(`value`: Output>) {
this.annotations = value
}
/**
* @param value Settings for the Binary Authorization feature.
*/
@JvmName("jbhssdbucrobusbp")
public suspend fun binaryAuthorization(`value`: Output) {
this.binaryAuthorization = value
}
/**
* @param value Arbitrary identifier for the API client.
*/
@JvmName("kxnumwaqolbyoegk")
public suspend fun client(`value`: Output) {
this.client = value
}
/**
* @param value Arbitrary version identifier for the API client.
*/
@JvmName("yaoqudowtthecjtr")
public suspend fun clientVersion(`value`: Output) {
this.clientVersion = value
}
/**
* @param value One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a
* string. The custom audiences are encoded in the token and used to authenticate requests. For more information, see
* https://cloud.google.com/run/docs/configuring/custom-audiences.
*/
@JvmName("kkkbqcrsblypapom")
public suspend fun customAudiences(`value`: Output>) {
this.customAudiences = value
}
@JvmName("dhxkduevrsatiiav")
public suspend fun customAudiences(vararg values: Output) {
this.customAudiences = Output.all(values.asList())
}
/**
* @param values One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a
* string. The custom audiences are encoded in the token and used to authenticate requests. For more information, see
* https://cloud.google.com/run/docs/configuring/custom-audiences.
*/
@JvmName("layvigtdwdqpersj")
public suspend fun customAudiences(values: List>) {
this.customAudiences = Output.all(values)
}
/**
* @param value Disables public resolution of the default URI of this service.
*/
@JvmName("rglpkribexpbxoqx")
public suspend fun defaultUriDisabled(`value`: Output) {
this.defaultUriDisabled = value
}
/**
* @param value User-provided description of the Service. This field currently has a 512-character limit.
*/
@JvmName("jktshyxoikodgwxm")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value Provides the ingress settings for this Service. On output, returns the currently observed ingress settings, or
* INGRESS_TRAFFIC_UNSPECIFIED if no revision is active. Possible values: ["INGRESS_TRAFFIC_ALL",
* "INGRESS_TRAFFIC_INTERNAL_ONLY", "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"]
*/
@JvmName("gwvuaxqfwurtxqke")
public suspend fun ingress(`value`: Output) {
this.ingress = value
}
/**
* @param value Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with
* Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment,
* state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or
* https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with
* 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they
* will be rejected. All system labels in v1 now have a corresponding field in v2 Service. **Note**: This field is
* non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
* 'effective_labels' for all of the labels present on the resource.
*/
@JvmName("stkebhokjoeonyfa")
public suspend fun labels(`value`: Output>) {
this.labels = value
}
/**
* @param value The launch stage as defined by [Google Cloud Platform Launch
* Stages](https://cloud.google.com/products#product-launch-stages). Cloud Run supports ALPHA, BETA, and GA. If no value is
* specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that
* stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as
* input, but only BETA and GA-level features are used, this field will be BETA on output. Possible values:
* ["UNIMPLEMENTED", "PRELAUNCH", "EARLY_ACCESS", "ALPHA", "BETA", "GA", "DEPRECATED"]
*/
@JvmName("cwtikhlkdgiwcccl")
public suspend fun launchStage(`value`: Output) {
this.launchStage = value
}
/**
* @param value The location of the cloud run service
*/
@JvmName("vctkgpenbbagiias")
public suspend fun location(`value`: Output) {
this.location = value
}
/**
* @param value Name of the Service.
*/
@JvmName("pxqsxapcxjqtljog")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value
*/
@JvmName("apqmttnxxkrlknmp")
public suspend fun project(`value`: Output) {
this.project = value
}
/**
* @param value Scaling settings that apply to the whole service
*/
@JvmName("nhpwvresrbrdridt")
public suspend fun scaling(`value`: Output) {
this.scaling = value
}
/**
* @param value The template used to create revisions for this Service.
* Structure is documented below.
*/
@JvmName("upusntppwaatqagd")
public suspend fun template(`value`: Output) {
this.template = value
}
/**
* @param value Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("yjbpnngnpxoojcva")
public suspend fun traffics(`value`: Output>) {
this.traffics = value
}
@JvmName("gvyjjfiucvwvguhl")
public suspend fun traffics(vararg values: Output) {
this.traffics = Output.all(values.asList())
}
/**
* @param values Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("chscshtxurjrltdn")
public suspend fun traffics(values: List>) {
this.traffics = Output.all(values)
}
/**
* @param value 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 in new
* resources. All system annotations in v1 now have a corresponding field in v2 Service. 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.
*/
@JvmName("vsmkcufcyccwxhrp")
public suspend fun annotations(`value`: Map?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.annotations = mapped
}
/**
* @param values 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 in new
* resources. All system annotations in v1 now have a corresponding field in v2 Service. 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.
*/
@JvmName("rrnlbmgypcplewsn")
public fun annotations(vararg values: Pair) {
val toBeMapped = values.toMap()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.annotations = mapped
}
/**
* @param value Settings for the Binary Authorization feature.
*/
@JvmName("tntlyqpoqeajttmh")
public suspend fun binaryAuthorization(`value`: ServiceBinaryAuthorizationArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.binaryAuthorization = mapped
}
/**
* @param argument Settings for the Binary Authorization feature.
*/
@JvmName("rbcrulaxeimdyewy")
public suspend fun binaryAuthorization(argument: suspend ServiceBinaryAuthorizationArgsBuilder.() -> Unit) {
val toBeMapped = ServiceBinaryAuthorizationArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.binaryAuthorization = mapped
}
/**
* @param value Arbitrary identifier for the API client.
*/
@JvmName("gfojddkskdjhfflg")
public suspend fun client(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.client = mapped
}
/**
* @param value Arbitrary version identifier for the API client.
*/
@JvmName("oatpbpiksllolvnm")
public suspend fun clientVersion(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.clientVersion = mapped
}
/**
* @param value One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a
* string. The custom audiences are encoded in the token and used to authenticate requests. For more information, see
* https://cloud.google.com/run/docs/configuring/custom-audiences.
*/
@JvmName("leawsoirdwyiuxhd")
public suspend fun customAudiences(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.customAudiences = mapped
}
/**
* @param values One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a
* string. The custom audiences are encoded in the token and used to authenticate requests. For more information, see
* https://cloud.google.com/run/docs/configuring/custom-audiences.
*/
@JvmName("qcaxojekruxpvkfh")
public suspend fun customAudiences(vararg values: String) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.customAudiences = mapped
}
/**
* @param value Disables public resolution of the default URI of this service.
*/
@JvmName("swnjosrcsonskfcp")
public suspend fun defaultUriDisabled(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.defaultUriDisabled = mapped
}
/**
* @param value User-provided description of the Service. This field currently has a 512-character limit.
*/
@JvmName("muwhtsuwqiblgacs")
public suspend fun description(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.description = mapped
}
/**
* @param value Provides the ingress settings for this Service. On output, returns the currently observed ingress settings, or
* INGRESS_TRAFFIC_UNSPECIFIED if no revision is active. Possible values: ["INGRESS_TRAFFIC_ALL",
* "INGRESS_TRAFFIC_INTERNAL_ONLY", "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"]
*/
@JvmName("bhhsupmycashbdav")
public suspend fun ingress(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.ingress = mapped
}
/**
* @param value Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with
* Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment,
* state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or
* https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with
* 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they
* will be rejected. All system labels in v1 now have a corresponding field in v2 Service. **Note**: This field is
* non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
* 'effective_labels' for all of the labels present on the resource.
*/
@JvmName("oixtrmmvltitoypx")
public suspend fun labels(`value`: Map?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.labels = mapped
}
/**
* @param values Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with
* Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment,
* state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or
* https://cloud.google.com/run/docs/configuring/labels. Cloud Run API v2 does not support labels with
* 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they
* will be rejected. All system labels in v1 now have a corresponding field in v2 Service. **Note**: This field is
* non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
* 'effective_labels' for all of the labels present on the resource.
*/
@JvmName("kvxiljqxvljteybv")
public fun labels(vararg values: Pair) {
val toBeMapped = values.toMap()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.labels = mapped
}
/**
* @param value The launch stage as defined by [Google Cloud Platform Launch
* Stages](https://cloud.google.com/products#product-launch-stages). Cloud Run supports ALPHA, BETA, and GA. If no value is
* specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that
* stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as
* input, but only BETA and GA-level features are used, this field will be BETA on output. Possible values:
* ["UNIMPLEMENTED", "PRELAUNCH", "EARLY_ACCESS", "ALPHA", "BETA", "GA", "DEPRECATED"]
*/
@JvmName("ilifouxkegpnmwyx")
public suspend fun launchStage(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.launchStage = mapped
}
/**
* @param value The location of the cloud run service
*/
@JvmName("ujxecnartskypqyp")
public suspend fun location(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.location = mapped
}
/**
* @param value Name of the Service.
*/
@JvmName("dwppfaqfuhoswapc")
public suspend fun name(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.name = mapped
}
/**
* @param value
*/
@JvmName("dlwwmfbtjpupglee")
public suspend fun project(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.project = mapped
}
/**
* @param value Scaling settings that apply to the whole service
*/
@JvmName("wqyaclimgdhnnjha")
public suspend fun scaling(`value`: ServiceScalingArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.scaling = mapped
}
/**
* @param argument Scaling settings that apply to the whole service
*/
@JvmName("cssrchyftvhgyiyq")
public suspend fun scaling(argument: suspend ServiceScalingArgsBuilder.() -> Unit) {
val toBeMapped = ServiceScalingArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.scaling = mapped
}
/**
* @param value The template used to create revisions for this Service.
* Structure is documented below.
*/
@JvmName("temkxainhyjroeki")
public suspend fun template(`value`: ServiceTemplateArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.template = mapped
}
/**
* @param argument The template used to create revisions for this Service.
* Structure is documented below.
*/
@JvmName("lyjgdsoflagemfws")
public suspend fun template(argument: suspend ServiceTemplateArgsBuilder.() -> Unit) {
val toBeMapped = ServiceTemplateArgsBuilder().applySuspend { argument() }.build()
val mapped = of(toBeMapped)
this.template = mapped
}
/**
* @param value Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("tbiupmdxirhrmagb")
public suspend fun traffics(`value`: List?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.traffics = mapped
}
/**
* @param argument Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("lakmwbvdkihsjyqu")
public suspend fun traffics(argument: List Unit>) {
val toBeMapped = argument.toList().map {
ServiceTrafficArgsBuilder().applySuspend {
it()
}.build()
}
val mapped = of(toBeMapped)
this.traffics = mapped
}
/**
* @param argument Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("prjqpdtreabvbqpb")
public suspend fun traffics(vararg argument: suspend ServiceTrafficArgsBuilder.() -> Unit) {
val toBeMapped = argument.toList().map {
ServiceTrafficArgsBuilder().applySuspend {
it()
}.build()
}
val mapped = of(toBeMapped)
this.traffics = mapped
}
/**
* @param argument Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("sjdobloddalrlact")
public suspend fun traffics(argument: suspend ServiceTrafficArgsBuilder.() -> Unit) {
val toBeMapped = listOf(ServiceTrafficArgsBuilder().applySuspend { argument() }.build())
val mapped = of(toBeMapped)
this.traffics = mapped
}
/**
* @param values Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not
* provided, defaults to 100% traffic to the latest Ready Revision.
*/
@JvmName("lwppvrqrhshxigmt")
public suspend fun traffics(vararg values: ServiceTrafficArgs) {
val toBeMapped = values.toList()
val mapped = toBeMapped.let({ args0 -> of(args0) })
this.traffics = mapped
}
internal fun build(): ServiceArgs = ServiceArgs(
annotations = annotations,
binaryAuthorization = binaryAuthorization,
client = client,
clientVersion = clientVersion,
customAudiences = customAudiences,
defaultUriDisabled = defaultUriDisabled,
description = description,
ingress = ingress,
labels = labels,
launchStage = launchStage,
location = location,
name = name,
project = project,
scaling = scaling,
template = template,
traffics = traffics,
)
}