com.pulumi.gcp.container.kotlin.Cluster.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.container.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.container.kotlin.outputs.ClusterAddonsConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterAuthenticatorGroupsConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterBinaryAuthorization
import com.pulumi.gcp.container.kotlin.outputs.ClusterClusterAutoscaling
import com.pulumi.gcp.container.kotlin.outputs.ClusterClusterTelemetry
import com.pulumi.gcp.container.kotlin.outputs.ClusterConfidentialNodes
import com.pulumi.gcp.container.kotlin.outputs.ClusterControlPlaneEndpointsConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterCostManagementConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterDatabaseEncryption
import com.pulumi.gcp.container.kotlin.outputs.ClusterDefaultSnatStatus
import com.pulumi.gcp.container.kotlin.outputs.ClusterDnsConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterEnableK8sBetaApis
import com.pulumi.gcp.container.kotlin.outputs.ClusterEnterpriseConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterFleet
import com.pulumi.gcp.container.kotlin.outputs.ClusterGatewayApiConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterIdentityServiceConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterIpAllocationPolicy
import com.pulumi.gcp.container.kotlin.outputs.ClusterLoggingConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterMaintenancePolicy
import com.pulumi.gcp.container.kotlin.outputs.ClusterMasterAuth
import com.pulumi.gcp.container.kotlin.outputs.ClusterMasterAuthorizedNetworksConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterMeshCertificates
import com.pulumi.gcp.container.kotlin.outputs.ClusterMonitoringConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterNetworkPolicy
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodeConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodePool
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodePoolAutoConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodePoolDefaults
import com.pulumi.gcp.container.kotlin.outputs.ClusterNotificationConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterPodSecurityPolicyConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterPrivateClusterConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterProtectConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterReleaseChannel
import com.pulumi.gcp.container.kotlin.outputs.ClusterResourceUsageExportConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterSecretManagerConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterSecurityPostureConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterServiceExternalIpsConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterTpuConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterUserManagedKeysConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterVerticalPodAutoscaling
import com.pulumi.gcp.container.kotlin.outputs.ClusterWorkloadAltsConfig
import com.pulumi.gcp.container.kotlin.outputs.ClusterWorkloadIdentityConfig
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.container.kotlin.outputs.ClusterAddonsConfig.Companion.toKotlin as clusterAddonsConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterAuthenticatorGroupsConfig.Companion.toKotlin as clusterAuthenticatorGroupsConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterBinaryAuthorization.Companion.toKotlin as clusterBinaryAuthorizationToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterClusterAutoscaling.Companion.toKotlin as clusterClusterAutoscalingToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterClusterTelemetry.Companion.toKotlin as clusterClusterTelemetryToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterConfidentialNodes.Companion.toKotlin as clusterConfidentialNodesToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterControlPlaneEndpointsConfig.Companion.toKotlin as clusterControlPlaneEndpointsConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterCostManagementConfig.Companion.toKotlin as clusterCostManagementConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterDatabaseEncryption.Companion.toKotlin as clusterDatabaseEncryptionToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterDefaultSnatStatus.Companion.toKotlin as clusterDefaultSnatStatusToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterDnsConfig.Companion.toKotlin as clusterDnsConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterEnableK8sBetaApis.Companion.toKotlin as clusterEnableK8sBetaApisToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterEnterpriseConfig.Companion.toKotlin as clusterEnterpriseConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterFleet.Companion.toKotlin as clusterFleetToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterGatewayApiConfig.Companion.toKotlin as clusterGatewayApiConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterIdentityServiceConfig.Companion.toKotlin as clusterIdentityServiceConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterIpAllocationPolicy.Companion.toKotlin as clusterIpAllocationPolicyToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterLoggingConfig.Companion.toKotlin as clusterLoggingConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterMaintenancePolicy.Companion.toKotlin as clusterMaintenancePolicyToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterMasterAuth.Companion.toKotlin as clusterMasterAuthToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterMasterAuthorizedNetworksConfig.Companion.toKotlin as clusterMasterAuthorizedNetworksConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterMeshCertificates.Companion.toKotlin as clusterMeshCertificatesToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterMonitoringConfig.Companion.toKotlin as clusterMonitoringConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterNetworkPolicy.Companion.toKotlin as clusterNetworkPolicyToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodeConfig.Companion.toKotlin as clusterNodeConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodePool.Companion.toKotlin as clusterNodePoolToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodePoolAutoConfig.Companion.toKotlin as clusterNodePoolAutoConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterNodePoolDefaults.Companion.toKotlin as clusterNodePoolDefaultsToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterNotificationConfig.Companion.toKotlin as clusterNotificationConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterPodSecurityPolicyConfig.Companion.toKotlin as clusterPodSecurityPolicyConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterPrivateClusterConfig.Companion.toKotlin as clusterPrivateClusterConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterProtectConfig.Companion.toKotlin as clusterProtectConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterReleaseChannel.Companion.toKotlin as clusterReleaseChannelToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterResourceUsageExportConfig.Companion.toKotlin as clusterResourceUsageExportConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterSecretManagerConfig.Companion.toKotlin as clusterSecretManagerConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterSecurityPostureConfig.Companion.toKotlin as clusterSecurityPostureConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterServiceExternalIpsConfig.Companion.toKotlin as clusterServiceExternalIpsConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterTpuConfig.Companion.toKotlin as clusterTpuConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterUserManagedKeysConfig.Companion.toKotlin as clusterUserManagedKeysConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterVerticalPodAutoscaling.Companion.toKotlin as clusterVerticalPodAutoscalingToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterWorkloadAltsConfig.Companion.toKotlin as clusterWorkloadAltsConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.ClusterWorkloadIdentityConfig.Companion.toKotlin as clusterWorkloadIdentityConfigToKotlin
/**
* Builder for [Cluster].
*/
@PulumiTagMarker
public class ClusterResourceBuilder internal constructor() {
public var name: String? = null
public var args: ClusterArgs = ClusterArgs()
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 ClusterArgsBuilder.() -> Unit) {
val builder = ClusterArgsBuilder()
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(): Cluster {
val builtJavaResource = com.pulumi.gcp.container.Cluster(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Cluster(builtJavaResource)
}
}
/**
* Manages a Google Kubernetes Engine (GKE) cluster.
* To get more information about GKE clusters, see:
* * [The API reference](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters)
* * How-to guides
* * [GKE overview](https://cloud.google.com/kubernetes-engine/docs/concepts/kubernetes-engine-overview)
* * [About cluster configuration choices](https://cloud.google.com/kubernetes-engine/docs/concepts/types-of-clusters)
* > On version 5.0.0+ of the provider, you must explicitly set `deletion_protection = false`
* and run `pulumi up` to write the field to state in order to destroy a cluster.
* > All arguments and attributes (including certificate outputs) will be stored in the raw state as
* plaintext. [Read more about secrets in state](https://www.pulumi.com/docs/intro/concepts/programming-model/#secrets).
* ## Example Usage
* ### With A Separately Managed Node Pool (Recommended)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.serviceaccount.Account("default", {
* accountId: "service-account-id",
* displayName: "Service Account",
* });
* const primary = new gcp.container.Cluster("primary", {
* name: "my-gke-cluster",
* location: "us-central1",
* removeDefaultNodePool: true,
* initialNodeCount: 1,
* });
* const primaryPreemptibleNodes = new gcp.container.NodePool("primary_preemptible_nodes", {
* name: "my-node-pool",
* location: "us-central1",
* cluster: primary.name,
* nodeCount: 1,
* nodeConfig: {
* preemptible: true,
* machineType: "e2-medium",
* serviceAccount: _default.email,
* oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.serviceaccount.Account("default",
* account_id="service-account-id",
* display_name="Service Account")
* primary = gcp.container.Cluster("primary",
* name="my-gke-cluster",
* location="us-central1",
* remove_default_node_pool=True,
* initial_node_count=1)
* primary_preemptible_nodes = gcp.container.NodePool("primary_preemptible_nodes",
* name="my-node-pool",
* location="us-central1",
* cluster=primary.name,
* node_count=1,
* node_config={
* "preemptible": True,
* "machine_type": "e2-medium",
* "service_account": default.email,
* "oauth_scopes": ["https://www.googleapis.com/auth/cloud-platform"],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.ServiceAccount.Account("default", new()
* {
* AccountId = "service-account-id",
* DisplayName = "Service Account",
* });
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "my-gke-cluster",
* Location = "us-central1",
* RemoveDefaultNodePool = true,
* InitialNodeCount = 1,
* });
* var primaryPreemptibleNodes = new Gcp.Container.NodePool("primary_preemptible_nodes", new()
* {
* Name = "my-node-pool",
* Location = "us-central1",
* Cluster = primary.Name,
* NodeCount = 1,
* NodeConfig = new Gcp.Container.Inputs.NodePoolNodeConfigArgs
* {
* Preemptible = true,
* MachineType = "e2-medium",
* ServiceAccount = @default.Email,
* OauthScopes = new[]
* {
* "https://www.googleapis.com/auth/cloud-platform",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
* AccountId: pulumi.String("service-account-id"),
* DisplayName: pulumi.String("Service Account"),
* })
* if err != nil {
* return err
* }
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("my-gke-cluster"),
* Location: pulumi.String("us-central1"),
* RemoveDefaultNodePool: pulumi.Bool(true),
* InitialNodeCount: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* _, err = container.NewNodePool(ctx, "primary_preemptible_nodes", &container.NodePoolArgs{
* Name: pulumi.String("my-node-pool"),
* Location: pulumi.String("us-central1"),
* Cluster: primary.Name,
* NodeCount: pulumi.Int(1),
* NodeConfig: &container.NodePoolNodeConfigArgs{
* Preemptible: pulumi.Bool(true),
* MachineType: pulumi.String("e2-medium"),
* ServiceAccount: _default.Email,
* OauthScopes: pulumi.StringArray{
* pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
* },
* },
* })
* 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.serviceaccount.Account;
* import com.pulumi.gcp.serviceaccount.AccountArgs;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.NodePool;
* import com.pulumi.gcp.container.NodePoolArgs;
* import com.pulumi.gcp.container.inputs.NodePoolNodeConfigArgs;
* 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 Account("default", AccountArgs.builder()
* .accountId("service-account-id")
* .displayName("Service Account")
* .build());
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("my-gke-cluster")
* .location("us-central1")
* .removeDefaultNodePool(true)
* .initialNodeCount(1)
* .build());
* var primaryPreemptibleNodes = new NodePool("primaryPreemptibleNodes", NodePoolArgs.builder()
* .name("my-node-pool")
* .location("us-central1")
* .cluster(primary.name())
* .nodeCount(1)
* .nodeConfig(NodePoolNodeConfigArgs.builder()
* .preemptible(true)
* .machineType("e2-medium")
* .serviceAccount(default_.email())
* .oauthScopes("https://www.googleapis.com/auth/cloud-platform")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:serviceaccount:Account
* properties:
* accountId: service-account-id
* displayName: Service Account
* primary:
* type: gcp:container:Cluster
* properties:
* name: my-gke-cluster
* location: us-central1
* removeDefaultNodePool: true
* initialNodeCount: 1
* primaryPreemptibleNodes:
* type: gcp:container:NodePool
* name: primary_preemptible_nodes
* properties:
* name: my-node-pool
* location: us-central1
* cluster: ${primary.name}
* nodeCount: 1
* nodeConfig:
* preemptible: true
* machineType: e2-medium
* serviceAccount: ${default.email}
* oauthScopes:
* - https://www.googleapis.com/auth/cloud-platform
* ```
*
* > **Note:** It is recommended that node pools be created and managed as separate resources as in the example above.
* This allows node pools to be added and removed without recreating the cluster. Node pools defined directly in the
* `gcp.container.Cluster` resource cannot be removed without re-creating the cluster.
* ### With The Default Node Pool
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.serviceaccount.Account("default", {
* accountId: "service-account-id",
* displayName: "Service Account",
* });
* const primary = new gcp.container.Cluster("primary", {
* name: "marcellus-wallace",
* location: "us-central1-a",
* initialNodeCount: 3,
* nodeConfig: {
* serviceAccount: _default.email,
* oauthScopes: ["https://www.googleapis.com/auth/cloud-platform"],
* labels: {
* foo: "bar",
* },
* tags: [
* "foo",
* "bar",
* ],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.serviceaccount.Account("default",
* account_id="service-account-id",
* display_name="Service Account")
* primary = gcp.container.Cluster("primary",
* name="marcellus-wallace",
* location="us-central1-a",
* initial_node_count=3,
* node_config={
* "service_account": default.email,
* "oauth_scopes": ["https://www.googleapis.com/auth/cloud-platform"],
* "labels": {
* "foo": "bar",
* },
* "tags": [
* "foo",
* "bar",
* ],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.ServiceAccount.Account("default", new()
* {
* AccountId = "service-account-id",
* DisplayName = "Service Account",
* });
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "marcellus-wallace",
* Location = "us-central1-a",
* InitialNodeCount = 3,
* NodeConfig = new Gcp.Container.Inputs.ClusterNodeConfigArgs
* {
* ServiceAccount = @default.Email,
* OauthScopes = new[]
* {
* "https://www.googleapis.com/auth/cloud-platform",
* },
* Labels =
* {
* { "foo", "bar" },
* },
* Tags = new[]
* {
* "foo",
* "bar",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
* AccountId: pulumi.String("service-account-id"),
* DisplayName: pulumi.String("Service Account"),
* })
* if err != nil {
* return err
* }
* _, err = container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("marcellus-wallace"),
* Location: pulumi.String("us-central1-a"),
* InitialNodeCount: pulumi.Int(3),
* NodeConfig: &container.ClusterNodeConfigArgs{
* ServiceAccount: _default.Email,
* OauthScopes: pulumi.StringArray{
* pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
* },
* Labels: pulumi.StringMap{
* "foo": pulumi.String("bar"),
* },
* Tags: pulumi.StringArray{
* pulumi.String("foo"),
* pulumi.String("bar"),
* },
* },
* })
* 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.serviceaccount.Account;
* import com.pulumi.gcp.serviceaccount.AccountArgs;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterNodeConfigArgs;
* 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 Account("default", AccountArgs.builder()
* .accountId("service-account-id")
* .displayName("Service Account")
* .build());
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("marcellus-wallace")
* .location("us-central1-a")
* .initialNodeCount(3)
* .nodeConfig(ClusterNodeConfigArgs.builder()
* .serviceAccount(default_.email())
* .oauthScopes("https://www.googleapis.com/auth/cloud-platform")
* .labels(Map.of("foo", "bar"))
* .tags(
* "foo",
* "bar")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:serviceaccount:Account
* properties:
* accountId: service-account-id
* displayName: Service Account
* primary:
* type: gcp:container:Cluster
* properties:
* name: marcellus-wallace
* location: us-central1-a
* initialNodeCount: 3
* nodeConfig:
* serviceAccount: ${default.email}
* oauthScopes:
* - https://www.googleapis.com/auth/cloud-platform
* labels:
* foo: bar
* tags:
* - foo
* - bar
* ```
*
* ### Autopilot
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.serviceaccount.Account("default", {
* accountId: "service-account-id",
* displayName: "Service Account",
* });
* const primary = new gcp.container.Cluster("primary", {
* name: "marcellus-wallace",
* location: "us-central1-a",
* enableAutopilot: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.serviceaccount.Account("default",
* account_id="service-account-id",
* display_name="Service Account")
* primary = gcp.container.Cluster("primary",
* name="marcellus-wallace",
* location="us-central1-a",
* enable_autopilot=True)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.ServiceAccount.Account("default", new()
* {
* AccountId = "service-account-id",
* DisplayName = "Service Account",
* });
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "marcellus-wallace",
* Location = "us-central1-a",
* EnableAutopilot = true,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
* AccountId: pulumi.String("service-account-id"),
* DisplayName: pulumi.String("Service Account"),
* })
* if err != nil {
* return err
* }
* _, err = container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("marcellus-wallace"),
* Location: pulumi.String("us-central1-a"),
* EnableAutopilot: pulumi.Bool(true),
* })
* 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.serviceaccount.Account;
* import com.pulumi.gcp.serviceaccount.AccountArgs;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* 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 Account("default", AccountArgs.builder()
* .accountId("service-account-id")
* .displayName("Service Account")
* .build());
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("marcellus-wallace")
* .location("us-central1-a")
* .enableAutopilot(true)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:serviceaccount:Account
* properties:
* accountId: service-account-id
* displayName: Service Account
* primary:
* type: gcp:container:Cluster
* properties:
* name: marcellus-wallace
* location: us-central1-a
* enableAutopilot: true
* ```
*
* ## Import
* GKE clusters can be imported using the `project` , `location`, and `name`. If the project is omitted, the default
* provider value will be used. Examples:
* * `projects/{{project_id}}/locations/{{location}}/clusters/{{cluster_id}}`
* * `{{project_id}}/{{location}}/{{cluster_id}}`
* * `{{location}}/{{cluster_id}}`
* When using the `pulumi import` command, GKE clusters can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:container/cluster:Cluster default projects/{{project_id}}/locations/{{location}}/clusters/{{cluster_id}}
* ```
* ```sh
* $ pulumi import gcp:container/cluster:Cluster default {{project_id}}/{{location}}/{{cluster_id}}
* ```
* ```sh
* $ pulumi import gcp:container/cluster:Cluster default {{location}}/{{cluster_id}}
* ```
* For example, the following fields will show diffs if set in config:
* - `min_master_version`
* - `remove_default_node_pool`
*/
public class Cluster internal constructor(
override val javaResource: com.pulumi.gcp.container.Cluster,
) : KotlinCustomResource(javaResource, ClusterMapper) {
/**
* The configuration for addons supported by GKE.
* Structure is documented below.
*/
public val addonsConfig: Output
get() = javaResource.addonsConfig().applyValue({ args0 ->
args0.let({ args0 ->
clusterAddonsConfigToKotlin(args0)
})
})
/**
* Enable NET_ADMIN for the cluster. Defaults to
* `false`. This field should only be enabled for Autopilot clusters (`enable_autopilot`
* set to `true`).
*/
public val allowNetAdmin: Output?
get() = javaResource.allowNetAdmin().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Configuration for the
* [Google Groups for GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control#groups-setup-gsuite) feature.
* Structure is documented below.
*/
public val authenticatorGroupsConfig: Output
get() = javaResource.authenticatorGroupsConfig().applyValue({ args0 ->
args0.let({ args0 ->
clusterAuthenticatorGroupsConfigToKotlin(args0)
})
})
/**
* Configuration options for the Binary
* Authorization feature. Structure is documented below.
*/
public val binaryAuthorization: Output?
get() = javaResource.binaryAuthorization().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> clusterBinaryAuthorizationToKotlin(args0) })
}).orElse(null)
})
/**
* Per-cluster configuration of Node Auto-Provisioning with Cluster Autoscaler to
* automatically adjust the size of the cluster and create/delete node pools based
* on the current needs of the cluster's workload. See the
* [guide to using Node Auto-Provisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning)
* for more details. Structure is documented below.
*/
public val clusterAutoscaling: Output
get() = javaResource.clusterAutoscaling().applyValue({ args0 ->
args0.let({ args0 ->
clusterClusterAutoscalingToKotlin(args0)
})
})
/**
* The IP address range of the Kubernetes pods
* in this cluster in CIDR notation (e.g. `10.96.0.0/14`). Leave blank to have one
* automatically chosen or specify a `/14` block in `10.0.0.0/8`. This field will
* default a new cluster to routes-based, where `ip_allocation_policy` is not defined.
*/
public val clusterIpv4Cidr: Output
get() = javaResource.clusterIpv4Cidr().applyValue({ args0 -> args0 })
/**
* Configuration for
* [ClusterTelemetry](https://cloud.google.com/monitoring/kubernetes-engine/installing#controlling_the_collection_of_application_logs) feature,
* Structure is documented below.
*/
public val clusterTelemetry: Output
get() = javaResource.clusterTelemetry().applyValue({ args0 ->
args0.let({ args0 ->
clusterClusterTelemetryToKotlin(args0)
})
})
/**
* Configuration for [Confidential Nodes](https://cloud.google.com/kubernetes-engine/docs/how-to/confidential-gke-nodes) feature. Structure is documented below documented below.
*/
public val confidentialNodes: Output
get() = javaResource.confidentialNodes().applyValue({ args0 ->
args0.let({ args0 ->
clusterConfidentialNodesToKotlin(args0)
})
})
/**
* Configuration for all of the cluster's control plane endpoints.
* Structure is documented below.
*/
public val controlPlaneEndpointsConfig: Output
get() = javaResource.controlPlaneEndpointsConfig().applyValue({ args0 ->
args0.let({ args0 ->
clusterControlPlaneEndpointsConfigToKotlin(args0)
})
})
/**
* Configuration for the
* [Cost Allocation](https://cloud.google.com/kubernetes-engine/docs/how-to/cost-allocations) feature.
* Structure is documented below.
*/
public val costManagementConfig: Output
get() = javaResource.costManagementConfig().applyValue({ args0 ->
args0.let({ args0 ->
clusterCostManagementConfigToKotlin(args0)
})
})
/**
* Structure is documented below.
*/
public val databaseEncryption: Output
get() = javaResource.databaseEncryption().applyValue({ args0 ->
args0.let({ args0 ->
clusterDatabaseEncryptionToKotlin(args0)
})
})
/**
* The desired datapath provider for this cluster. This is set to `LEGACY_DATAPATH` by default, which uses the IPTables-based kube-proxy implementation. Set to `ADVANCED_DATAPATH` to enable Dataplane v2.
*/
public val datapathProvider: Output
get() = javaResource.datapathProvider().applyValue({ args0 -> args0 })
/**
* The default maximum number of pods
* per node in this cluster. This doesn't work on "routes-based" clusters, clusters
* that don't have IP Aliasing enabled. See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/flexible-pod-cidr)
* for more information.
*/
public val defaultMaxPodsPerNode: Output
get() = javaResource.defaultMaxPodsPerNode().applyValue({ args0 -> args0 })
/**
* [GKE SNAT](https://cloud.google.com/kubernetes-engine/docs/how-to/ip-masquerade-agent#how_ipmasq_works) DefaultSnatStatus contains the desired state of whether default sNAT should be disabled on the cluster, [API doc](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#networkconfig). Structure is documented below
*/
public val defaultSnatStatus: Output
get() = javaResource.defaultSnatStatus().applyValue({ args0 ->
args0.let({ args0 ->
clusterDefaultSnatStatusToKotlin(args0)
})
})
public val deletionProtection: Output?
get() = javaResource.deletionProtection().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Description of the cluster.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Configuration for [Using Cloud DNS for GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/cloud-dns). Structure is documented below.
*/
public val dnsConfig: Output?
get() = javaResource.dnsConfig().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
clusterDnsConfigToKotlin(args0)
})
}).orElse(null)
})
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
public val effectiveLabels: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy