com.pulumi.gcp.cloudrunv2.kotlin.Service.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.cloudrunv2.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceBinaryAuthorization
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceCondition
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceScaling
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTemplate
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTerminalCondition
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTraffic
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTrafficStatus
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceBinaryAuthorization.Companion.toKotlin as serviceBinaryAuthorizationToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceCondition.Companion.toKotlin as serviceConditionToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceScaling.Companion.toKotlin as serviceScalingToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTemplate.Companion.toKotlin as serviceTemplateToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTerminalCondition.Companion.toKotlin as serviceTerminalConditionToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTraffic.Companion.toKotlin as serviceTrafficToKotlin
import com.pulumi.gcp.cloudrunv2.kotlin.outputs.ServiceTrafficStatus.Companion.toKotlin as serviceTrafficStatusToKotlin
/**
* Builder for [Service].
*/
@PulumiTagMarker
public class ServiceResourceBuilder internal constructor() {
public var name: String? = null
public var args: ServiceArgs = ServiceArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend ServiceArgsBuilder.() -> Unit) {
val builder = ServiceArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Service {
val builtJavaResource = com.pulumi.gcp.cloudrunv2.Service(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Service(builtJavaResource)
}
}
/**
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* resources=gcp.cloudrunv2.ServiceTemplateContainerResourcesArgs(
* 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 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,
* }],
* });
* const project = gcp.organizations.getProject({});
* const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
* secret: secret.name,
* secretData: "secret-data",
* });
* const secret_access = new gcp.secretmanager.SecretIamMember("secret-access", {
* secretId: secret.id,
* role: "roles/secretmanager.secretAccessor",
* member: project.then(project => `serviceAccount:${project.number}[email protected]`),
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secret = gcp.secretmanager.Secret("secret",
* secret_id="secret-1",
* replication=gcp.secretmanager.SecretReplicationArgs(
* auto=gcp.secretmanager.SecretReplicationAutoArgs(),
* ))
* instance = gcp.sql.DatabaseInstance("instance",
* name="cloudrun-sql",
* region="us-central1",
* database_version="MYSQL_5_7",
* settings=gcp.sql.DatabaseInstanceSettingsArgs(
* tier="db-f1-micro",
* ),
* deletion_protection=True)
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* template=gcp.cloudrunv2.ServiceTemplateArgs(
* scaling=gcp.cloudrunv2.ServiceTemplateScalingArgs(
* max_instance_count=2,
* ),
* volumes=[gcp.cloudrunv2.ServiceTemplateVolumeArgs(
* name="cloudsql",
* cloud_sql_instance=gcp.cloudrunv2.ServiceTemplateVolumeCloudSqlInstanceArgs(
* instances=[instance.connection_name],
* ),
* )],
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* envs=[
* gcp.cloudrunv2.ServiceTemplateContainerEnvArgs(
* name="FOO",
* value="bar",
* ),
* gcp.cloudrunv2.ServiceTemplateContainerEnvArgs(
* name="SECRET_ENV_VAR",
* value_source=gcp.cloudrunv2.ServiceTemplateContainerEnvValueSourceArgs(
* secret_key_ref=gcp.cloudrunv2.ServiceTemplateContainerEnvValueSourceSecretKeyRefArgs(
* secret=secret.secret_id,
* version="1",
* ),
* ),
* ),
* ],
* volume_mounts=[gcp.cloudrunv2.ServiceTemplateContainerVolumeMountArgs(
* name="cloudsql",
* mount_path="/cloudsql",
* )],
* )],
* ),
* traffics=[gcp.cloudrunv2.ServiceTrafficArgs(
* type="TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST",
* percent=100,
* )])
* project = gcp.organizations.get_project()
* secret_version_data = gcp.secretmanager.SecretVersion("secret-version-data",
* secret=secret.name,
* secret_data="secret-data")
* secret_access = gcp.secretmanager.SecretIamMember("secret-access",
* secret_id=secret.id,
* role="roles/secretmanager.secretAccessor",
* member=f"serviceAccount:{project.number}[email protected]")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var secret = new Gcp.SecretManager.Secret("secret", new()
* {
* SecretId = "secret-1",
* Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
* {
* Auto = null,
* },
* });
* var instance = new Gcp.Sql.DatabaseInstance("instance", new()
* {
* Name = "cloudrun-sql",
* Region = "us-central1",
* DatabaseVersion = "MYSQL_5_7",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* DeletionProtection = true,
* });
* var @default = new Gcp.CloudRunV2.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,
* },
* },
* });
* var project = Gcp.Organizations.GetProject.Invoke();
* var secret_version_data = new Gcp.SecretManager.SecretVersion("secret-version-data", new()
* {
* Secret = secret.Name,
* SecretData = "secret-data",
* });
* var secret_access = new Gcp.SecretManager.SecretIamMember("secret-access", new()
* {
* SecretId = secret.Id,
* Role = "roles/secretmanager.secretAccessor",
* Member = $"serviceAccount:{project.Apply(getProjectResult => getProjectResult.Number)}[email protected]",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* secret, err := secretmanager.NewSecret(ctx, "secret", &secretmanager.SecretArgs{
* SecretId: pulumi.String("secret-1"),
* Replication: &secretmanager.SecretReplicationArgs{
* Auto: nil,
* },
* })
* if err != nil {
* return err
* }
* instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
* Name: pulumi.String("cloudrun-sql"),
* Region: pulumi.String("us-central1"),
* DatabaseVersion: pulumi.String("MYSQL_5_7"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* DeletionProtection: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* _, err = cloudrunv2.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),
* },
* },
* })
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretVersion(ctx, "secret-version-data", &secretmanager.SecretVersionArgs{
* Secret: secret.Name,
* SecretData: pulumi.String("secret-data"),
* })
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretIamMember(ctx, "secret-access", &secretmanager.SecretIamMemberArgs{
* SecretId: secret.ID(),
* Role: pulumi.String("roles/secretmanager.secretAccessor"),
* Member: pulumi.String(fmt.Sprintf("serviceAccount:%[email protected]", project.Number)),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.secretmanager.Secret;
* import com.pulumi.gcp.secretmanager.SecretArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.cloudrunv2.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.SecretVersion;
* import com.pulumi.gcp.secretmanager.SecretVersionArgs;
* import com.pulumi.gcp.secretmanager.SecretIamMember;
* import com.pulumi.gcp.secretmanager.SecretIamMemberArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var secret = new Secret("secret", SecretArgs.builder()
* .secretId("secret-1")
* .replication(SecretReplicationArgs.builder()
* .auto()
* .build())
* .build());
* var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
* .name("cloudrun-sql")
* .region("us-central1")
* .databaseVersion("MYSQL_5_7")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .deletionProtection("true")
* .build());
* var default_ = new 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());
* final var project = OrganizationsFunctions.getProject();
* var secret_version_data = new SecretVersion("secret-version-data", SecretVersionArgs.builder()
* .secret(secret.name())
* .secretData("secret-data")
* .build());
* var secret_access = new SecretIamMember("secret-access", SecretIamMemberArgs.builder()
* .secretId(secret.id())
* .role("roles/secretmanager.secretAccessor")
* .member(String.format("serviceAccount:%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2: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
* 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]
* 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=gcp.vpcaccess.ConnectorSubnetArgs(
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* )],
* vpc_access=gcp.cloudrunv2.ServiceTemplateVpcAccessArgs(
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* )],
* vpc_access=gcp.cloudrunv2.ServiceTemplateVpcAccessArgs(
* network_interfaces=[gcp.cloudrunv2.ServiceTemplateVpcAccessNetworkInterfaceArgs(
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* startup_probe=gcp.cloudrunv2.ServiceTemplateContainerStartupProbeArgs(
* initial_delay_seconds=0,
* timeout_seconds=1,
* period_seconds=3,
* failure_threshold=1,
* tcp_socket=gcp.cloudrunv2.ServiceTemplateContainerStartupProbeTcpSocketArgs(
* port=8080,
* ),
* ),
* liveness_probe=gcp.cloudrunv2.ServiceTemplateContainerLivenessProbeArgs(
* http_get=gcp.cloudrunv2.ServiceTemplateContainerLivenessProbeHttpGetArgs(
* 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 _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",
* }],
* }],
* },
* });
* const project = gcp.organizations.getProject({});
* const secret_version_data = new gcp.secretmanager.SecretVersion("secret-version-data", {
* secret: secret.name,
* secretData: "secret-data",
* });
* const secret_access = new gcp.secretmanager.SecretIamMember("secret-access", {
* secretId: secret.id,
* role: "roles/secretmanager.secretAccessor",
* member: project.then(project => `serviceAccount:${project.number}[email protected]`),
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* secret = gcp.secretmanager.Secret("secret",
* secret_id="secret-1",
* replication=gcp.secretmanager.SecretReplicationArgs(
* auto=gcp.secretmanager.SecretReplicationAutoArgs(),
* ))
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* template=gcp.cloudrunv2.ServiceTemplateArgs(
* volumes=[gcp.cloudrunv2.ServiceTemplateVolumeArgs(
* name="a-volume",
* secret=gcp.cloudrunv2.ServiceTemplateVolumeSecretArgs(
* secret=secret.secret_id,
* default_mode=292,
* items=[gcp.cloudrunv2.ServiceTemplateVolumeSecretItemArgs(
* version="1",
* path="my-secret",
* )],
* ),
* )],
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* volume_mounts=[gcp.cloudrunv2.ServiceTemplateContainerVolumeMountArgs(
* name="a-volume",
* mount_path="/secrets",
* )],
* )],
* ))
* project = gcp.organizations.get_project()
* secret_version_data = gcp.secretmanager.SecretVersion("secret-version-data",
* secret=secret.name,
* secret_data="secret-data")
* secret_access = gcp.secretmanager.SecretIamMember("secret-access",
* secret_id=secret.id,
* role="roles/secretmanager.secretAccessor",
* member=f"serviceAccount:{project.number}[email protected]")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var secret = new Gcp.SecretManager.Secret("secret", new()
* {
* SecretId = "secret-1",
* Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
* {
* Auto = null,
* },
* });
* 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",
* },
* },
* },
* },
* },
* });
* var project = Gcp.Organizations.GetProject.Invoke();
* var secret_version_data = new Gcp.SecretManager.SecretVersion("secret-version-data", new()
* {
* Secret = secret.Name,
* SecretData = "secret-data",
* });
* var secret_access = new Gcp.SecretManager.SecretIamMember("secret-access", new()
* {
* SecretId = secret.Id,
* Role = "roles/secretmanager.secretAccessor",
* Member = $"serviceAccount:{project.Apply(getProjectResult => getProjectResult.Number)}[email protected]",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/secretmanager"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* secret, err := secretmanager.NewSecret(ctx, "secret", &secretmanager.SecretArgs{
* SecretId: pulumi.String("secret-1"),
* Replication: &secretmanager.SecretReplicationArgs{
* Auto: nil,
* },
* })
* 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"),
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretVersion(ctx, "secret-version-data", &secretmanager.SecretVersionArgs{
* Secret: secret.Name,
* SecretData: pulumi.String("secret-data"),
* })
* if err != nil {
* return err
* }
* _, err = secretmanager.NewSecretIamMember(ctx, "secret-access", &secretmanager.SecretIamMemberArgs{
* SecretId: secret.ID(),
* Role: pulumi.String("roles/secretmanager.secretAccessor"),
* Member: pulumi.String(fmt.Sprintf("serviceAccount:%[email protected]", project.Number)),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.secretmanager.Secret;
* import com.pulumi.gcp.secretmanager.SecretArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
* import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
* import com.pulumi.gcp.cloudrunv2.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.SecretVersion;
* import com.pulumi.gcp.secretmanager.SecretVersionArgs;
* import com.pulumi.gcp.secretmanager.SecretIamMember;
* import com.pulumi.gcp.secretmanager.SecretIamMemberArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var secret = new Secret("secret", SecretArgs.builder()
* .secretId("secret-1")
* .replication(SecretReplicationArgs.builder()
* .auto()
* .build())
* .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());
* final var project = OrganizationsFunctions.getProject();
* var secret_version_data = new SecretVersion("secret-version-data", SecretVersionArgs.builder()
* .secret(secret.name())
* .secretData("secret-data")
* .build());
* var secret_access = new SecretIamMember("secret-access", SecretIamMemberArgs.builder()
* .secretId(secret.id())
* .role("roles/secretmanager.secretAccessor")
* .member(String.format("serviceAccount:%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:cloudrunv2: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
* 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]
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* containers=[
* gcp.cloudrunv2.ServiceTemplateContainerArgs(
* name="hello-1",
* ports={
* "containerPort": 8080,
* },
* image="us-docker.pkg.dev/cloudrun/container/hello",
* depends_ons=["hello-2"],
* volume_mounts=[gcp.cloudrunv2.ServiceTemplateContainerVolumeMountArgs(
* name="empty-dir-volume",
* mount_path="/mnt",
* )],
* ),
* gcp.cloudrunv2.ServiceTemplateContainerArgs(
* name="hello-2",
* image="us-docker.pkg.dev/cloudrun/container/hello",
* envs=[gcp.cloudrunv2.ServiceTemplateContainerEnvArgs(
* name="PORT",
* value="8081",
* )],
* startup_probe=gcp.cloudrunv2.ServiceTemplateContainerStartupProbeArgs(
* http_get=gcp.cloudrunv2.ServiceTemplateContainerStartupProbeHttpGetArgs(
* port=8081,
* ),
* ),
* ),
* ],
* volumes=[gcp.cloudrunv2.ServiceTemplateVolumeArgs(
* name="empty-dir-volume",
* empty_dir=gcp.cloudrunv2.ServiceTemplateVolumeEmptyDirArgs(
* 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=gcp.cloudrunv2.ServiceTemplateArgs(
* execution_environment="EXECUTION_ENVIRONMENT_GEN2",
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello",
* volume_mounts=[gcp.cloudrunv2.ServiceTemplateContainerVolumeMountArgs(
* name="bucket",
* mount_path="/var/www",
* )],
* )],
* volumes=[gcp.cloudrunv2.ServiceTemplateVolumeArgs(
* name="bucket",
* gcs=gcp.cloudrunv2.ServiceTemplateVolumeGcsArgs(
* 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=gcp.filestore.InstanceFileSharesArgs(
* capacity_gb=1024,
* name="share1",
* ),
* networks=[gcp.filestore.InstanceNetworkArgs(
* network="default",
* modes=["MODE_IPV4"],
* )])
* default = gcp.cloudrunv2.Service("default",
* name="cloudrun-service",
* location="us-central1",
* ingress="INGRESS_TRAFFIC_ALL",
* launch_stage="BETA",
* template=gcp.cloudrunv2.ServiceTemplateArgs(
* execution_environment="EXECUTION_ENVIRONMENT_GEN2",
* containers=[gcp.cloudrunv2.ServiceTemplateContainerArgs(
* image="us-docker.pkg.dev/cloudrun/container/hello:latest",
* volume_mounts=[gcp.cloudrunv2.ServiceTemplateContainerVolumeMountArgs(
* name="nfs",
* mount_path="/mnt/nfs/filestore",
* )],
* )],
* vpc_access=gcp.cloudrunv2.ServiceTemplateVpcAccessArgs(
* network_interfaces=[gcp.cloudrunv2.ServiceTemplateVpcAccessNetworkInterfaceArgs(
* network="default",
* subnetwork="default",
* )],
* ),
* volumes=[gcp.cloudrunv2.ServiceTemplateVolumeArgs(
* name="nfs",
* nfs=gcp.cloudrunv2.ServiceTemplateVolumeNfsArgs(
* 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}}
* ```
*/
public class Service internal constructor(
override val javaResource: com.pulumi.gcp.cloudrunv2.Service,
) : KotlinCustomResource(javaResource, ServiceMapper) {
/**
* 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.
*/
public val annotations: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy