All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.edgecontainer.kotlin.NodePool.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.edgecontainer.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.edgecontainer.kotlin.outputs.NodePoolLocalDiskEncryption
import com.pulumi.gcp.edgecontainer.kotlin.outputs.NodePoolNodeConfig
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.Map
import com.pulumi.gcp.edgecontainer.kotlin.outputs.NodePoolLocalDiskEncryption.Companion.toKotlin as nodePoolLocalDiskEncryptionToKotlin
import com.pulumi.gcp.edgecontainer.kotlin.outputs.NodePoolNodeConfig.Companion.toKotlin as nodePoolNodeConfigToKotlin

/**
 * Builder for [NodePool].
 */
@PulumiTagMarker
public class NodePoolResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NodePoolArgs = NodePoolArgs()

    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 NodePoolArgsBuilder.() -> Unit) {
        val builder = NodePoolArgsBuilder()
        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(): NodePool {
        val builtJavaResource = com.pulumi.gcp.edgecontainer.NodePool(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return NodePool(builtJavaResource)
    }
}

/**
 * "A set of Kubernetes nodes in a cluster with common configuration and specification."
 * To get more information about NodePool, see:
 * * [API documentation](https://cloud.google.com/distributed-cloud/edge/latest/docs/reference/container/rest/v1/projects.locations.clusters.nodePools)
 * * How-to Guides
 *     * [Google Distributed Cloud Edge](https://cloud.google.com/distributed-cloud/edge/latest/docs)
 * ## Example Usage
 * ### Edgecontainer Node Pool
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const cluster = new gcp.edgecontainer.Cluster("cluster", {
 *     name: "default",
 *     location: "us-central1",
 *     authorization: {
 *         adminUsers: {
 *             username: "[email protected]",
 *         },
 *     },
 *     networking: {
 *         clusterIpv4CidrBlocks: ["10.0.0.0/16"],
 *         servicesIpv4CidrBlocks: ["10.1.0.0/16"],
 *     },
 *     fleet: {
 *         project: project.then(project => `projects/${project.number}`),
 *     },
 * });
 * const _default = new gcp.edgecontainer.NodePool("default", {
 *     name: "nodepool-1",
 *     cluster: cluster.name,
 *     location: "us-central1",
 *     nodeLocation: "us-central1-edge-example-edgesite",
 *     nodeCount: 3,
 *     labels: {
 *         my_key: "my_val",
 *         other_key: "other_val",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * cluster = gcp.edgecontainer.Cluster("cluster",
 *     name="default",
 *     location="us-central1",
 *     authorization={
 *         "admin_users": {
 *             "username": "[email protected]",
 *         },
 *     },
 *     networking={
 *         "cluster_ipv4_cidr_blocks": ["10.0.0.0/16"],
 *         "services_ipv4_cidr_blocks": ["10.1.0.0/16"],
 *     },
 *     fleet={
 *         "project": f"projects/{project.number}",
 *     })
 * default = gcp.edgecontainer.NodePool("default",
 *     name="nodepool-1",
 *     cluster=cluster.name,
 *     location="us-central1",
 *     node_location="us-central1-edge-example-edgesite",
 *     node_count=3,
 *     labels={
 *         "my_key": "my_val",
 *         "other_key": "other_val",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var cluster = new Gcp.EdgeContainer.Cluster("cluster", new()
 *     {
 *         Name = "default",
 *         Location = "us-central1",
 *         Authorization = new Gcp.EdgeContainer.Inputs.ClusterAuthorizationArgs
 *         {
 *             AdminUsers = new Gcp.EdgeContainer.Inputs.ClusterAuthorizationAdminUsersArgs
 *             {
 *                 Username = "[email protected]",
 *             },
 *         },
 *         Networking = new Gcp.EdgeContainer.Inputs.ClusterNetworkingArgs
 *         {
 *             ClusterIpv4CidrBlocks = new[]
 *             {
 *                 "10.0.0.0/16",
 *             },
 *             ServicesIpv4CidrBlocks = new[]
 *             {
 *                 "10.1.0.0/16",
 *             },
 *         },
 *         Fleet = new Gcp.EdgeContainer.Inputs.ClusterFleetArgs
 *         {
 *             Project = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
 *         },
 *     });
 *     var @default = new Gcp.EdgeContainer.NodePool("default", new()
 *     {
 *         Name = "nodepool-1",
 *         Cluster = cluster.Name,
 *         Location = "us-central1",
 *         NodeLocation = "us-central1-edge-example-edgesite",
 *         NodeCount = 3,
 *         Labels =
 *         {
 *             { "my_key", "my_val" },
 *             { "other_key", "other_val" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/edgecontainer"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cluster, err := edgecontainer.NewCluster(ctx, "cluster", &edgecontainer.ClusterArgs{
 * 			Name:     pulumi.String("default"),
 * 			Location: pulumi.String("us-central1"),
 * 			Authorization: &edgecontainer.ClusterAuthorizationArgs{
 * 				AdminUsers: &edgecontainer.ClusterAuthorizationAdminUsersArgs{
 * 					Username: pulumi.String("[email protected]"),
 * 				},
 * 			},
 * 			Networking: &edgecontainer.ClusterNetworkingArgs{
 * 				ClusterIpv4CidrBlocks: pulumi.StringArray{
 * 					pulumi.String("10.0.0.0/16"),
 * 				},
 * 				ServicesIpv4CidrBlocks: pulumi.StringArray{
 * 					pulumi.String("10.1.0.0/16"),
 * 				},
 * 			},
 * 			Fleet: &edgecontainer.ClusterFleetArgs{
 * 				Project: pulumi.Sprintf("projects/%v", project.Number),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = edgecontainer.NewNodePool(ctx, "default", &edgecontainer.NodePoolArgs{
 * 			Name:         pulumi.String("nodepool-1"),
 * 			Cluster:      cluster.Name,
 * 			Location:     pulumi.String("us-central1"),
 * 			NodeLocation: pulumi.String("us-central1-edge-example-edgesite"),
 * 			NodeCount:    pulumi.Int(3),
 * 			Labels: pulumi.StringMap{
 * 				"my_key":    pulumi.String("my_val"),
 * 				"other_key": pulumi.String("other_val"),
 * 			},
 * 		})
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.edgecontainer.Cluster;
 * import com.pulumi.gcp.edgecontainer.ClusterArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterAuthorizationArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterAuthorizationAdminUsersArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterNetworkingArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterFleetArgs;
 * import com.pulumi.gcp.edgecontainer.NodePool;
 * import com.pulumi.gcp.edgecontainer.NodePoolArgs;
 * 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) {
 *         final var project = OrganizationsFunctions.getProject();
 *         var cluster = new Cluster("cluster", ClusterArgs.builder()
 *             .name("default")
 *             .location("us-central1")
 *             .authorization(ClusterAuthorizationArgs.builder()
 *                 .adminUsers(ClusterAuthorizationAdminUsersArgs.builder()
 *                     .username("[email protected]")
 *                     .build())
 *                 .build())
 *             .networking(ClusterNetworkingArgs.builder()
 *                 .clusterIpv4CidrBlocks("10.0.0.0/16")
 *                 .servicesIpv4CidrBlocks("10.1.0.0/16")
 *                 .build())
 *             .fleet(ClusterFleetArgs.builder()
 *                 .project(String.format("projects/%s", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                 .build())
 *             .build());
 *         var default_ = new NodePool("default", NodePoolArgs.builder()
 *             .name("nodepool-1")
 *             .cluster(cluster.name())
 *             .location("us-central1")
 *             .nodeLocation("us-central1-edge-example-edgesite")
 *             .nodeCount(3)
 *             .labels(Map.ofEntries(
 *                 Map.entry("my_key", "my_val"),
 *                 Map.entry("other_key", "other_val")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   cluster:
 *     type: gcp:edgecontainer:Cluster
 *     properties:
 *       name: default
 *       location: us-central1
 *       authorization:
 *         adminUsers:
 *           username: [email protected]
 *       networking:
 *         clusterIpv4CidrBlocks:
 *           - 10.0.0.0/16
 *         servicesIpv4CidrBlocks:
 *           - 10.1.0.0/16
 *       fleet:
 *         project: projects/${project.number}
 *   default:
 *     type: gcp:edgecontainer:NodePool
 *     properties:
 *       name: nodepool-1
 *       cluster: ${cluster.name}
 *       location: us-central1
 *       nodeLocation: us-central1-edge-example-edgesite
 *       nodeCount: 3
 *       labels:
 *         my_key: my_val
 *         other_key: other_val
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ### Edgecontainer Node Pool With Cmek
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const cluster = new gcp.edgecontainer.Cluster("cluster", {
 *     name: "default",
 *     location: "us-central1",
 *     authorization: {
 *         adminUsers: {
 *             username: "[email protected]",
 *         },
 *     },
 *     networking: {
 *         clusterIpv4CidrBlocks: ["10.0.0.0/16"],
 *         servicesIpv4CidrBlocks: ["10.1.0.0/16"],
 *     },
 *     fleet: {
 *         project: project.then(project => `projects/${project.number}`),
 *     },
 * });
 * const keyRing = new gcp.kms.KeyRing("key_ring", {
 *     name: "keyring",
 *     location: "us-central1",
 * });
 * const cryptoKeyCryptoKey = new gcp.kms.CryptoKey("crypto_key", {
 *     name: "key",
 *     keyRing: keyRing.id,
 * });
 * const cryptoKey = new gcp.kms.CryptoKeyIAMMember("crypto_key", {
 *     cryptoKeyId: cryptoKeyCryptoKey.id,
 *     role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-edgecontainer.iam.gserviceaccount.com`),
 * });
 * const _default = new gcp.edgecontainer.NodePool("default", {
 *     name: "nodepool-1",
 *     cluster: cluster.name,
 *     location: "us-central1",
 *     nodeLocation: "us-central1-edge-example-edgesite",
 *     nodeCount: 3,
 *     localDiskEncryption: {
 *         kmsKey: cryptoKeyCryptoKey.id,
 *     },
 * }, {
 *     dependsOn: [cryptoKey],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * cluster = gcp.edgecontainer.Cluster("cluster",
 *     name="default",
 *     location="us-central1",
 *     authorization={
 *         "admin_users": {
 *             "username": "[email protected]",
 *         },
 *     },
 *     networking={
 *         "cluster_ipv4_cidr_blocks": ["10.0.0.0/16"],
 *         "services_ipv4_cidr_blocks": ["10.1.0.0/16"],
 *     },
 *     fleet={
 *         "project": f"projects/{project.number}",
 *     })
 * key_ring = gcp.kms.KeyRing("key_ring",
 *     name="keyring",
 *     location="us-central1")
 * crypto_key_crypto_key = gcp.kms.CryptoKey("crypto_key",
 *     name="key",
 *     key_ring=key_ring.id)
 * crypto_key = gcp.kms.CryptoKeyIAMMember("crypto_key",
 *     crypto_key_id=crypto_key_crypto_key.id,
 *     role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *     member=f"serviceAccount:service-{project.number}@gcp-sa-edgecontainer.iam.gserviceaccount.com")
 * default = gcp.edgecontainer.NodePool("default",
 *     name="nodepool-1",
 *     cluster=cluster.name,
 *     location="us-central1",
 *     node_location="us-central1-edge-example-edgesite",
 *     node_count=3,
 *     local_disk_encryption={
 *         "kms_key": crypto_key_crypto_key.id,
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[crypto_key]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var cluster = new Gcp.EdgeContainer.Cluster("cluster", new()
 *     {
 *         Name = "default",
 *         Location = "us-central1",
 *         Authorization = new Gcp.EdgeContainer.Inputs.ClusterAuthorizationArgs
 *         {
 *             AdminUsers = new Gcp.EdgeContainer.Inputs.ClusterAuthorizationAdminUsersArgs
 *             {
 *                 Username = "[email protected]",
 *             },
 *         },
 *         Networking = new Gcp.EdgeContainer.Inputs.ClusterNetworkingArgs
 *         {
 *             ClusterIpv4CidrBlocks = new[]
 *             {
 *                 "10.0.0.0/16",
 *             },
 *             ServicesIpv4CidrBlocks = new[]
 *             {
 *                 "10.1.0.0/16",
 *             },
 *         },
 *         Fleet = new Gcp.EdgeContainer.Inputs.ClusterFleetArgs
 *         {
 *             Project = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
 *         },
 *     });
 *     var keyRing = new Gcp.Kms.KeyRing("key_ring", new()
 *     {
 *         Name = "keyring",
 *         Location = "us-central1",
 *     });
 *     var cryptoKeyCryptoKey = new Gcp.Kms.CryptoKey("crypto_key", new()
 *     {
 *         Name = "key",
 *         KeyRing = keyRing.Id,
 *     });
 *     var cryptoKey = new Gcp.Kms.CryptoKeyIAMMember("crypto_key", new()
 *     {
 *         CryptoKeyId = cryptoKeyCryptoKey.Id,
 *         Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
 *         Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-edgecontainer.iam.gserviceaccount.com",
 *     });
 *     var @default = new Gcp.EdgeContainer.NodePool("default", new()
 *     {
 *         Name = "nodepool-1",
 *         Cluster = cluster.Name,
 *         Location = "us-central1",
 *         NodeLocation = "us-central1-edge-example-edgesite",
 *         NodeCount = 3,
 *         LocalDiskEncryption = new Gcp.EdgeContainer.Inputs.NodePoolLocalDiskEncryptionArgs
 *         {
 *             KmsKey = cryptoKeyCryptoKey.Id,
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             cryptoKey,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/edgecontainer"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cluster, err := edgecontainer.NewCluster(ctx, "cluster", &edgecontainer.ClusterArgs{
 * 			Name:     pulumi.String("default"),
 * 			Location: pulumi.String("us-central1"),
 * 			Authorization: &edgecontainer.ClusterAuthorizationArgs{
 * 				AdminUsers: &edgecontainer.ClusterAuthorizationAdminUsersArgs{
 * 					Username: pulumi.String("[email protected]"),
 * 				},
 * 			},
 * 			Networking: &edgecontainer.ClusterNetworkingArgs{
 * 				ClusterIpv4CidrBlocks: pulumi.StringArray{
 * 					pulumi.String("10.0.0.0/16"),
 * 				},
 * 				ServicesIpv4CidrBlocks: pulumi.StringArray{
 * 					pulumi.String("10.1.0.0/16"),
 * 				},
 * 			},
 * 			Fleet: &edgecontainer.ClusterFleetArgs{
 * 				Project: pulumi.Sprintf("projects/%v", project.Number),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		keyRing, err := kms.NewKeyRing(ctx, "key_ring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("keyring"),
 * 			Location: pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cryptoKeyCryptoKey, err := kms.NewCryptoKey(ctx, "crypto_key", &kms.CryptoKeyArgs{
 * 			Name:    pulumi.String("key"),
 * 			KeyRing: keyRing.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		cryptoKey, err := kms.NewCryptoKeyIAMMember(ctx, "crypto_key", &kms.CryptoKeyIAMMemberArgs{
 * 			CryptoKeyId: cryptoKeyCryptoKey.ID(),
 * 			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
 * 			Member:      pulumi.Sprintf("serviceAccount:service-%[email protected]", project.Number),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = edgecontainer.NewNodePool(ctx, "default", &edgecontainer.NodePoolArgs{
 * 			Name:         pulumi.String("nodepool-1"),
 * 			Cluster:      cluster.Name,
 * 			Location:     pulumi.String("us-central1"),
 * 			NodeLocation: pulumi.String("us-central1-edge-example-edgesite"),
 * 			NodeCount:    pulumi.Int(3),
 * 			LocalDiskEncryption: &edgecontainer.NodePoolLocalDiskEncryptionArgs{
 * 				KmsKey: cryptoKeyCryptoKey.ID(),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			cryptoKey,
 * 		}))
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.edgecontainer.Cluster;
 * import com.pulumi.gcp.edgecontainer.ClusterArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterAuthorizationArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterAuthorizationAdminUsersArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterNetworkingArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterFleetArgs;
 * import com.pulumi.gcp.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.kms.CryptoKeyIAMMember;
 * import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
 * import com.pulumi.gcp.edgecontainer.NodePool;
 * import com.pulumi.gcp.edgecontainer.NodePoolArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.NodePoolLocalDiskEncryptionArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         final var project = OrganizationsFunctions.getProject();
 *         var cluster = new Cluster("cluster", ClusterArgs.builder()
 *             .name("default")
 *             .location("us-central1")
 *             .authorization(ClusterAuthorizationArgs.builder()
 *                 .adminUsers(ClusterAuthorizationAdminUsersArgs.builder()
 *                     .username("[email protected]")
 *                     .build())
 *                 .build())
 *             .networking(ClusterNetworkingArgs.builder()
 *                 .clusterIpv4CidrBlocks("10.0.0.0/16")
 *                 .servicesIpv4CidrBlocks("10.1.0.0/16")
 *                 .build())
 *             .fleet(ClusterFleetArgs.builder()
 *                 .project(String.format("projects/%s", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                 .build())
 *             .build());
 *         var keyRing = new KeyRing("keyRing", KeyRingArgs.builder()
 *             .name("keyring")
 *             .location("us-central1")
 *             .build());
 *         var cryptoKeyCryptoKey = new CryptoKey("cryptoKeyCryptoKey", CryptoKeyArgs.builder()
 *             .name("key")
 *             .keyRing(keyRing.id())
 *             .build());
 *         var cryptoKey = new CryptoKeyIAMMember("cryptoKey", CryptoKeyIAMMemberArgs.builder()
 *             .cryptoKeyId(cryptoKeyCryptoKey.id())
 *             .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
 *             .member(String.format("serviceAccount:service-%[email protected]", project.applyValue(getProjectResult -> getProjectResult.number())))
 *             .build());
 *         var default_ = new NodePool("default", NodePoolArgs.builder()
 *             .name("nodepool-1")
 *             .cluster(cluster.name())
 *             .location("us-central1")
 *             .nodeLocation("us-central1-edge-example-edgesite")
 *             .nodeCount(3)
 *             .localDiskEncryption(NodePoolLocalDiskEncryptionArgs.builder()
 *                 .kmsKey(cryptoKeyCryptoKey.id())
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(cryptoKey)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   cluster:
 *     type: gcp:edgecontainer:Cluster
 *     properties:
 *       name: default
 *       location: us-central1
 *       authorization:
 *         adminUsers:
 *           username: [email protected]
 *       networking:
 *         clusterIpv4CidrBlocks:
 *           - 10.0.0.0/16
 *         servicesIpv4CidrBlocks:
 *           - 10.1.0.0/16
 *       fleet:
 *         project: projects/${project.number}
 *   cryptoKey:
 *     type: gcp:kms:CryptoKeyIAMMember
 *     name: crypto_key
 *     properties:
 *       cryptoKeyId: ${cryptoKeyCryptoKey.id}
 *       role: roles/cloudkms.cryptoKeyEncrypterDecrypter
 *       member: serviceAccount:service-${project.number}@gcp-sa-edgecontainer.iam.gserviceaccount.com
 *   cryptoKeyCryptoKey:
 *     type: gcp:kms:CryptoKey
 *     name: crypto_key
 *     properties:
 *       name: key
 *       keyRing: ${keyRing.id}
 *   keyRing:
 *     type: gcp:kms:KeyRing
 *     name: key_ring
 *     properties:
 *       name: keyring
 *       location: us-central1
 *   default:
 *     type: gcp:edgecontainer:NodePool
 *     properties:
 *       name: nodepool-1
 *       cluster: ${cluster.name}
 *       location: us-central1
 *       nodeLocation: us-central1-edge-example-edgesite
 *       nodeCount: 3
 *       localDiskEncryption:
 *         kmsKey: ${cryptoKeyCryptoKey.id}
 *     options:
 *       dependson:
 *         - ${cryptoKey}
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ### Edgecontainer Local Control Plane Node Pool
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const _default = new gcp.edgecontainer.Cluster("default", {
 *     name: "",
 *     location: "us-central1",
 *     authorization: {
 *         adminUsers: {
 *             username: "[email protected]",
 *         },
 *     },
 *     networking: {
 *         clusterIpv4CidrBlocks: ["10.0.0.0/16"],
 *         servicesIpv4CidrBlocks: ["10.1.0.0/16"],
 *     },
 *     fleet: {
 *         project: project.then(project => `projects/${project.number}`),
 *     },
 *     externalLoadBalancerIpv4AddressPools: ["10.100.0.0-10.100.0.10"],
 *     controlPlane: {
 *         local: {
 *             nodeLocation: "us-central1-edge-example-edgesite",
 *             nodeCount: 1,
 *             machineFilter: "machine-name",
 *             sharedDeploymentPolicy: "ALLOWED",
 *         },
 *     },
 * });
 * const defaultNodePool = new gcp.edgecontainer.NodePool("default", {
 *     name: "nodepool-1",
 *     cluster: cluster.name,
 *     location: "us-central1",
 *     nodeLocation: "us-central1-edge-example-edgesite",
 *     nodeCount: 3,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * default = gcp.edgecontainer.Cluster("default",
 *     name="",
 *     location="us-central1",
 *     authorization={
 *         "admin_users": {
 *             "username": "[email protected]",
 *         },
 *     },
 *     networking={
 *         "cluster_ipv4_cidr_blocks": ["10.0.0.0/16"],
 *         "services_ipv4_cidr_blocks": ["10.1.0.0/16"],
 *     },
 *     fleet={
 *         "project": f"projects/{project.number}",
 *     },
 *     external_load_balancer_ipv4_address_pools=["10.100.0.0-10.100.0.10"],
 *     control_plane={
 *         "local": {
 *             "node_location": "us-central1-edge-example-edgesite",
 *             "node_count": 1,
 *             "machine_filter": "machine-name",
 *             "shared_deployment_policy": "ALLOWED",
 *         },
 *     })
 * default_node_pool = gcp.edgecontainer.NodePool("default",
 *     name="nodepool-1",
 *     cluster=cluster["name"],
 *     location="us-central1",
 *     node_location="us-central1-edge-example-edgesite",
 *     node_count=3)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var @default = new Gcp.EdgeContainer.Cluster("default", new()
 *     {
 *         Name = "",
 *         Location = "us-central1",
 *         Authorization = new Gcp.EdgeContainer.Inputs.ClusterAuthorizationArgs
 *         {
 *             AdminUsers = new Gcp.EdgeContainer.Inputs.ClusterAuthorizationAdminUsersArgs
 *             {
 *                 Username = "[email protected]",
 *             },
 *         },
 *         Networking = new Gcp.EdgeContainer.Inputs.ClusterNetworkingArgs
 *         {
 *             ClusterIpv4CidrBlocks = new[]
 *             {
 *                 "10.0.0.0/16",
 *             },
 *             ServicesIpv4CidrBlocks = new[]
 *             {
 *                 "10.1.0.0/16",
 *             },
 *         },
 *         Fleet = new Gcp.EdgeContainer.Inputs.ClusterFleetArgs
 *         {
 *             Project = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
 *         },
 *         ExternalLoadBalancerIpv4AddressPools = new[]
 *         {
 *             "10.100.0.0-10.100.0.10",
 *         },
 *         ControlPlane = new Gcp.EdgeContainer.Inputs.ClusterControlPlaneArgs
 *         {
 *             Local = new Gcp.EdgeContainer.Inputs.ClusterControlPlaneLocalArgs
 *             {
 *                 NodeLocation = "us-central1-edge-example-edgesite",
 *                 NodeCount = 1,
 *                 MachineFilter = "machine-name",
 *                 SharedDeploymentPolicy = "ALLOWED",
 *             },
 *         },
 *     });
 *     var defaultNodePool = new Gcp.EdgeContainer.NodePool("default", new()
 *     {
 *         Name = "nodepool-1",
 *         Cluster = cluster.Name,
 *         Location = "us-central1",
 *         NodeLocation = "us-central1-edge-example-edgesite",
 *         NodeCount = 3,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/edgecontainer"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		project, err := organizations.LookupProject(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = edgecontainer.NewCluster(ctx, "default", &edgecontainer.ClusterArgs{
 * 			Name:     pulumi.String(""),
 * 			Location: pulumi.String("us-central1"),
 * 			Authorization: &edgecontainer.ClusterAuthorizationArgs{
 * 				AdminUsers: &edgecontainer.ClusterAuthorizationAdminUsersArgs{
 * 					Username: pulumi.String("[email protected]"),
 * 				},
 * 			},
 * 			Networking: &edgecontainer.ClusterNetworkingArgs{
 * 				ClusterIpv4CidrBlocks: pulumi.StringArray{
 * 					pulumi.String("10.0.0.0/16"),
 * 				},
 * 				ServicesIpv4CidrBlocks: pulumi.StringArray{
 * 					pulumi.String("10.1.0.0/16"),
 * 				},
 * 			},
 * 			Fleet: &edgecontainer.ClusterFleetArgs{
 * 				Project: pulumi.Sprintf("projects/%v", project.Number),
 * 			},
 * 			ExternalLoadBalancerIpv4AddressPools: pulumi.StringArray{
 * 				pulumi.String("10.100.0.0-10.100.0.10"),
 * 			},
 * 			ControlPlane: &edgecontainer.ClusterControlPlaneArgs{
 * 				Local: &edgecontainer.ClusterControlPlaneLocalArgs{
 * 					NodeLocation:           pulumi.String("us-central1-edge-example-edgesite"),
 * 					NodeCount:              pulumi.Int(1),
 * 					MachineFilter:          pulumi.String("machine-name"),
 * 					SharedDeploymentPolicy: pulumi.String("ALLOWED"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = edgecontainer.NewNodePool(ctx, "default", &edgecontainer.NodePoolArgs{
 * 			Name:         pulumi.String("nodepool-1"),
 * 			Cluster:      pulumi.Any(cluster.Name),
 * 			Location:     pulumi.String("us-central1"),
 * 			NodeLocation: pulumi.String("us-central1-edge-example-edgesite"),
 * 			NodeCount:    pulumi.Int(3),
 * 		})
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.edgecontainer.Cluster;
 * import com.pulumi.gcp.edgecontainer.ClusterArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterAuthorizationArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterAuthorizationAdminUsersArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterNetworkingArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterFleetArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterControlPlaneArgs;
 * import com.pulumi.gcp.edgecontainer.inputs.ClusterControlPlaneLocalArgs;
 * import com.pulumi.gcp.edgecontainer.NodePool;
 * import com.pulumi.gcp.edgecontainer.NodePoolArgs;
 * 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) {
 *         final var project = OrganizationsFunctions.getProject();
 *         var default_ = new Cluster("default", ClusterArgs.builder()
 *             .name("")
 *             .location("us-central1")
 *             .authorization(ClusterAuthorizationArgs.builder()
 *                 .adminUsers(ClusterAuthorizationAdminUsersArgs.builder()
 *                     .username("[email protected]")
 *                     .build())
 *                 .build())
 *             .networking(ClusterNetworkingArgs.builder()
 *                 .clusterIpv4CidrBlocks("10.0.0.0/16")
 *                 .servicesIpv4CidrBlocks("10.1.0.0/16")
 *                 .build())
 *             .fleet(ClusterFleetArgs.builder()
 *                 .project(String.format("projects/%s", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                 .build())
 *             .externalLoadBalancerIpv4AddressPools("10.100.0.0-10.100.0.10")
 *             .controlPlane(ClusterControlPlaneArgs.builder()
 *                 .local(ClusterControlPlaneLocalArgs.builder()
 *                     .nodeLocation("us-central1-edge-example-edgesite")
 *                     .nodeCount(1)
 *                     .machineFilter("machine-name")
 *                     .sharedDeploymentPolicy("ALLOWED")
 *                     .build())
 *                 .build())
 *             .build());
 *         var defaultNodePool = new NodePool("defaultNodePool", NodePoolArgs.builder()
 *             .name("nodepool-1")
 *             .cluster(cluster.name())
 *             .location("us-central1")
 *             .nodeLocation("us-central1-edge-example-edgesite")
 *             .nodeCount(3)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:edgecontainer:Cluster
 *     properties:
 *       name:
 *       location: us-central1
 *       authorization:
 *         adminUsers:
 *           username: [email protected]
 *       networking:
 *         clusterIpv4CidrBlocks:
 *           - 10.0.0.0/16
 *         servicesIpv4CidrBlocks:
 *           - 10.1.0.0/16
 *       fleet:
 *         project: projects/${project.number}
 *       externalLoadBalancerIpv4AddressPools:
 *         - 10.100.0.0-10.100.0.10
 *       controlPlane:
 *         local:
 *           nodeLocation: us-central1-edge-example-edgesite
 *           nodeCount: 1
 *           machineFilter: machine-name
 *           sharedDeploymentPolicy: ALLOWED
 *   defaultNodePool:
 *     type: gcp:edgecontainer:NodePool
 *     name: default
 *     properties:
 *       name: nodepool-1
 *       cluster: ${cluster.name}
 *       location: us-central1
 *       nodeLocation: us-central1-edge-example-edgesite
 *       nodeCount: 3
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * NodePool can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/nodePools/{{name}}`
 * * `{{project}}/{{location}}/{{cluster}}/{{name}}`
 * * `{{location}}/{{cluster}}/{{name}}`
 * When using the `pulumi import` command, NodePool can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:edgecontainer/nodePool:NodePool default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/nodePools/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:edgecontainer/nodePool:NodePool default {{project}}/{{location}}/{{cluster}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:edgecontainer/nodePool:NodePool default {{location}}/{{cluster}}/{{name}}
 * ```
 */
public class NodePool internal constructor(
    override val javaResource: com.pulumi.gcp.edgecontainer.NodePool,
) : KotlinCustomResource(javaResource, NodePoolMapper) {
    /**
     * The name of the target Distributed Cloud Edge Cluster.
     * - - -
     */
    public val cluster: Output
        get() = javaResource.cluster().applyValue({ args0 -> args0 })

    /**
     * The time when the node pool was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * 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>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Labels associated with this resource.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Local disk encryption options. This field is only used when enabling CMEK support.
     * Structure is documented below.
     */
    public val localDiskEncryption: Output?
        get() = javaResource.localDiskEncryption().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> nodePoolLocalDiskEncryptionToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The location of the resource.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Only machines matching this filter will be allowed to join the node pool.
     * The filtering language accepts strings like "name=", and is
     * documented in more detail in [AIP-160](https://google.aip.dev/160).
     */
    public val machineFilter: Output
        get() = javaResource.machineFilter().applyValue({ args0 -> args0 })

    /**
     * The resource name of the node pool.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Configuration for each node in the NodePool
     * Structure is documented below.
     */
    public val nodeConfig: Output
        get() = javaResource.nodeConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                nodePoolNodeConfigToKotlin(args0)
            })
        })

    /**
     * The number of nodes in the pool.
     */
    public val nodeCount: Output
        get() = javaResource.nodeCount().applyValue({ args0 -> args0 })

    /**
     * Name of the Google Distributed Cloud Edge zone where this node pool will be created. For example: `us-central1-edge-customer-a`.
     */
    public val nodeLocation: Output
        get() = javaResource.nodeLocation().applyValue({ args0 -> args0 })

    /**
     * The lowest release version among all worker nodes.
     */
    public val nodeVersion: Output
        get() = javaResource.nodeVersion().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The time when the node pool was last updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object NodePoolMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.edgecontainer.NodePool::class == javaResource::class

    override fun map(javaResource: Resource): NodePool = NodePool(
        javaResource as
            com.pulumi.gcp.edgecontainer.NodePool,
    )
}

/**
 * @see [NodePool].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NodePool].
 */
public suspend fun nodePool(name: String, block: suspend NodePoolResourceBuilder.() -> Unit): NodePool {
    val builder = NodePoolResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NodePool].
 * @param name The _unique_ name of the resulting resource.
 */
public fun nodePool(name: String): NodePool {
    val builder = NodePoolResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy