com.pulumi.gcp.cloudbuild.kotlin.WorkerPool.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.cloudbuild.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.cloudbuild.kotlin.outputs.WorkerPoolNetworkConfig
import com.pulumi.gcp.cloudbuild.kotlin.outputs.WorkerPoolWorkerConfig
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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.gcp.cloudbuild.kotlin.outputs.WorkerPoolNetworkConfig.Companion.toKotlin as workerPoolNetworkConfigToKotlin
import com.pulumi.gcp.cloudbuild.kotlin.outputs.WorkerPoolWorkerConfig.Companion.toKotlin as workerPoolWorkerConfigToKotlin
/**
* Builder for [WorkerPool].
*/
@PulumiTagMarker
public class WorkerPoolResourceBuilder internal constructor() {
public var name: String? = null
public var args: WorkerPoolArgs = WorkerPoolArgs()
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 WorkerPoolArgsBuilder.() -> Unit) {
val builder = WorkerPoolArgsBuilder()
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(): WorkerPool {
val builtJavaResource = com.pulumi.gcp.cloudbuild.WorkerPool(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return WorkerPool(builtJavaResource)
}
}
/**
* Definition of custom Cloud Build WorkerPools for running jobs with custom configuration and custom networking.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const pool = new gcp.cloudbuild.WorkerPool("pool", {
* name: "my-pool",
* location: "europe-west1",
* workerConfig: {
* diskSizeGb: 100,
* machineType: "e2-standard-4",
* noExternalIp: false,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* pool = gcp.cloudbuild.WorkerPool("pool",
* name="my-pool",
* location="europe-west1",
* worker_config=gcp.cloudbuild.WorkerPoolWorkerConfigArgs(
* disk_size_gb=100,
* machine_type="e2-standard-4",
* no_external_ip=False,
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var pool = new Gcp.CloudBuild.WorkerPool("pool", new()
* {
* Name = "my-pool",
* Location = "europe-west1",
* WorkerConfig = new Gcp.CloudBuild.Inputs.WorkerPoolWorkerConfigArgs
* {
* DiskSizeGb = 100,
* MachineType = "e2-standard-4",
* NoExternalIp = false,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudbuild"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudbuild.NewWorkerPool(ctx, "pool", &cloudbuild.WorkerPoolArgs{
* Name: pulumi.String("my-pool"),
* Location: pulumi.String("europe-west1"),
* WorkerConfig: &cloudbuild.WorkerPoolWorkerConfigArgs{
* DiskSizeGb: pulumi.Int(100),
* MachineType: pulumi.String("e2-standard-4"),
* NoExternalIp: 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.cloudbuild.WorkerPool;
* import com.pulumi.gcp.cloudbuild.WorkerPoolArgs;
* import com.pulumi.gcp.cloudbuild.inputs.WorkerPoolWorkerConfigArgs;
* 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 pool = new WorkerPool("pool", WorkerPoolArgs.builder()
* .name("my-pool")
* .location("europe-west1")
* .workerConfig(WorkerPoolWorkerConfigArgs.builder()
* .diskSizeGb(100)
* .machineType("e2-standard-4")
* .noExternalIp(false)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* pool:
* type: gcp:cloudbuild:WorkerPool
* properties:
* name: my-pool
* location: europe-west1
* workerConfig:
* diskSizeGb: 100
* machineType: e2-standard-4
* noExternalIp: false
* ```
*
* ### Network Config
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const servicenetworking = new gcp.projects.Service("servicenetworking", {
* service: "servicenetworking.googleapis.com",
* disableOnDestroy: false,
* });
* const network = new gcp.compute.Network("network", {
* name: "my-network",
* autoCreateSubnetworks: false,
* });
* const workerRange = new gcp.compute.GlobalAddress("worker_range", {
* name: "worker-pool-range",
* purpose: "VPC_PEERING",
* addressType: "INTERNAL",
* prefixLength: 16,
* network: network.id,
* });
* const workerPoolConn = new gcp.servicenetworking.Connection("worker_pool_conn", {
* network: network.id,
* service: "servicenetworking.googleapis.com",
* reservedPeeringRanges: [workerRange.name],
* });
* const pool = new gcp.cloudbuild.WorkerPool("pool", {
* name: "my-pool",
* location: "europe-west1",
* workerConfig: {
* diskSizeGb: 100,
* machineType: "e2-standard-4",
* noExternalIp: false,
* },
* networkConfig: {
* peeredNetwork: network.id,
* peeredNetworkIpRange: "/29",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* servicenetworking = gcp.projects.Service("servicenetworking",
* service="servicenetworking.googleapis.com",
* disable_on_destroy=False)
* network = gcp.compute.Network("network",
* name="my-network",
* auto_create_subnetworks=False)
* worker_range = gcp.compute.GlobalAddress("worker_range",
* name="worker-pool-range",
* purpose="VPC_PEERING",
* address_type="INTERNAL",
* prefix_length=16,
* network=network.id)
* worker_pool_conn = gcp.servicenetworking.Connection("worker_pool_conn",
* network=network.id,
* service="servicenetworking.googleapis.com",
* reserved_peering_ranges=[worker_range.name])
* pool = gcp.cloudbuild.WorkerPool("pool",
* name="my-pool",
* location="europe-west1",
* worker_config=gcp.cloudbuild.WorkerPoolWorkerConfigArgs(
* disk_size_gb=100,
* machine_type="e2-standard-4",
* no_external_ip=False,
* ),
* network_config=gcp.cloudbuild.WorkerPoolNetworkConfigArgs(
* peered_network=network.id,
* peered_network_ip_range="/29",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var servicenetworking = new Gcp.Projects.Service("servicenetworking", new()
* {
* ServiceName = "servicenetworking.googleapis.com",
* DisableOnDestroy = false,
* });
* var network = new Gcp.Compute.Network("network", new()
* {
* Name = "my-network",
* AutoCreateSubnetworks = false,
* });
* var workerRange = new Gcp.Compute.GlobalAddress("worker_range", new()
* {
* Name = "worker-pool-range",
* Purpose = "VPC_PEERING",
* AddressType = "INTERNAL",
* PrefixLength = 16,
* Network = network.Id,
* });
* var workerPoolConn = new Gcp.ServiceNetworking.Connection("worker_pool_conn", new()
* {
* Network = network.Id,
* Service = "servicenetworking.googleapis.com",
* ReservedPeeringRanges = new[]
* {
* workerRange.Name,
* },
* });
* var pool = new Gcp.CloudBuild.WorkerPool("pool", new()
* {
* Name = "my-pool",
* Location = "europe-west1",
* WorkerConfig = new Gcp.CloudBuild.Inputs.WorkerPoolWorkerConfigArgs
* {
* DiskSizeGb = 100,
* MachineType = "e2-standard-4",
* NoExternalIp = false,
* },
* NetworkConfig = new Gcp.CloudBuild.Inputs.WorkerPoolNetworkConfigArgs
* {
* PeeredNetwork = network.Id,
* PeeredNetworkIpRange = "/29",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudbuild"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := projects.NewService(ctx, "servicenetworking", &projects.ServiceArgs{
* Service: pulumi.String("servicenetworking.googleapis.com"),
* DisableOnDestroy: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
* Name: pulumi.String("my-network"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* workerRange, err := compute.NewGlobalAddress(ctx, "worker_range", &compute.GlobalAddressArgs{
* Name: pulumi.String("worker-pool-range"),
* Purpose: pulumi.String("VPC_PEERING"),
* AddressType: pulumi.String("INTERNAL"),
* PrefixLength: pulumi.Int(16),
* Network: network.ID(),
* })
* if err != nil {
* return err
* }
* _, err = servicenetworking.NewConnection(ctx, "worker_pool_conn", &servicenetworking.ConnectionArgs{
* Network: network.ID(),
* Service: pulumi.String("servicenetworking.googleapis.com"),
* ReservedPeeringRanges: pulumi.StringArray{
* workerRange.Name,
* },
* })
* if err != nil {
* return err
* }
* _, err = cloudbuild.NewWorkerPool(ctx, "pool", &cloudbuild.WorkerPoolArgs{
* Name: pulumi.String("my-pool"),
* Location: pulumi.String("europe-west1"),
* WorkerConfig: &cloudbuild.WorkerPoolWorkerConfigArgs{
* DiskSizeGb: pulumi.Int(100),
* MachineType: pulumi.String("e2-standard-4"),
* NoExternalIp: pulumi.Bool(false),
* },
* NetworkConfig: &cloudbuild.WorkerPoolNetworkConfigArgs{
* PeeredNetwork: network.ID(),
* PeeredNetworkIpRange: pulumi.String("/29"),
* },
* })
* 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.projects.Service;
* import com.pulumi.gcp.projects.ServiceArgs;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.GlobalAddress;
* import com.pulumi.gcp.compute.GlobalAddressArgs;
* import com.pulumi.gcp.servicenetworking.Connection;
* import com.pulumi.gcp.servicenetworking.ConnectionArgs;
* import com.pulumi.gcp.cloudbuild.WorkerPool;
* import com.pulumi.gcp.cloudbuild.WorkerPoolArgs;
* import com.pulumi.gcp.cloudbuild.inputs.WorkerPoolWorkerConfigArgs;
* import com.pulumi.gcp.cloudbuild.inputs.WorkerPoolNetworkConfigArgs;
* 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 servicenetworking = new Service("servicenetworking", ServiceArgs.builder()
* .service("servicenetworking.googleapis.com")
* .disableOnDestroy(false)
* .build());
* var network = new Network("network", NetworkArgs.builder()
* .name("my-network")
* .autoCreateSubnetworks(false)
* .build());
* var workerRange = new GlobalAddress("workerRange", GlobalAddressArgs.builder()
* .name("worker-pool-range")
* .purpose("VPC_PEERING")
* .addressType("INTERNAL")
* .prefixLength(16)
* .network(network.id())
* .build());
* var workerPoolConn = new Connection("workerPoolConn", ConnectionArgs.builder()
* .network(network.id())
* .service("servicenetworking.googleapis.com")
* .reservedPeeringRanges(workerRange.name())
* .build());
* var pool = new WorkerPool("pool", WorkerPoolArgs.builder()
* .name("my-pool")
* .location("europe-west1")
* .workerConfig(WorkerPoolWorkerConfigArgs.builder()
* .diskSizeGb(100)
* .machineType("e2-standard-4")
* .noExternalIp(false)
* .build())
* .networkConfig(WorkerPoolNetworkConfigArgs.builder()
* .peeredNetwork(network.id())
* .peeredNetworkIpRange("/29")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* servicenetworking:
* type: gcp:projects:Service
* properties:
* service: servicenetworking.googleapis.com
* disableOnDestroy: false
* network:
* type: gcp:compute:Network
* properties:
* name: my-network
* autoCreateSubnetworks: false
* workerRange:
* type: gcp:compute:GlobalAddress
* name: worker_range
* properties:
* name: worker-pool-range
* purpose: VPC_PEERING
* addressType: INTERNAL
* prefixLength: 16
* network: ${network.id}
* workerPoolConn:
* type: gcp:servicenetworking:Connection
* name: worker_pool_conn
* properties:
* network: ${network.id}
* service: servicenetworking.googleapis.com
* reservedPeeringRanges:
* - ${workerRange.name}
* pool:
* type: gcp:cloudbuild:WorkerPool
* properties:
* name: my-pool
* location: europe-west1
* workerConfig:
* diskSizeGb: 100
* machineType: e2-standard-4
* noExternalIp: false
* networkConfig:
* peeredNetwork: ${network.id}
* peeredNetworkIpRange: /29
* ```
*
* ## Import
* WorkerPool can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/workerPools/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
* When using the `pulumi import` command, WorkerPool can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:cloudbuild/workerPool:WorkerPool default projects/{{project}}/locations/{{location}}/workerPools/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudbuild/workerPool:WorkerPool default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:cloudbuild/workerPool:WorkerPool default {{location}}/{{name}}
* ```
*/
public class WorkerPool internal constructor(
override val javaResource: com.pulumi.gcp.cloudbuild.WorkerPool,
) : KotlinCustomResource(javaResource, WorkerPoolMapper) {
/**
* User specified annotations. See https://google.aip.dev/128#annotations for more details such as format and size
* limitations. **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