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

com.pulumi.gcp.container.kotlin.AttachedCluster.kt Maven / Gradle / Ivy

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

package com.pulumi.gcp.container.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterAuthorization
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterBinaryAuthorization
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterError
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterFleet
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterLoggingConfig
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterMonitoringConfig
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterOidcConfig
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterProxyConfig
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterWorkloadIdentityConfig
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.container.kotlin.outputs.AttachedClusterAuthorization.Companion.toKotlin as attachedClusterAuthorizationToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterBinaryAuthorization.Companion.toKotlin as attachedClusterBinaryAuthorizationToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterError.Companion.toKotlin as attachedClusterErrorToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterFleet.Companion.toKotlin as attachedClusterFleetToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterLoggingConfig.Companion.toKotlin as attachedClusterLoggingConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterMonitoringConfig.Companion.toKotlin as attachedClusterMonitoringConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterOidcConfig.Companion.toKotlin as attachedClusterOidcConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterProxyConfig.Companion.toKotlin as attachedClusterProxyConfigToKotlin
import com.pulumi.gcp.container.kotlin.outputs.AttachedClusterWorkloadIdentityConfig.Companion.toKotlin as attachedClusterWorkloadIdentityConfigToKotlin

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

    public var args: AttachedClusterArgs = AttachedClusterArgs()

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

/**
 * An Anthos cluster running on customer owned infrastructure.
 * To get more information about Cluster, see:
 * * [API documentation](https://cloud.google.com/anthos/clusters/docs/multi-cloud/reference/rest)
 * * How-to Guides
 *     * [API reference](https://cloud.google.com/anthos/clusters/docs/multi-cloud/reference/rest/v1/projects.locations.attachedClusters)
 *     * [Multicloud overview](https://cloud.google.com/anthos/clusters/docs/multi-cloud)
 * ## Example Usage
 * ### Container Attached Cluster Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const versions = project.then(project => gcp.container.getAttachedVersions({
 *     location: "us-west1",
 *     project: project.projectId,
 * }));
 * const primary = new gcp.container.AttachedCluster("primary", {
 *     name: "basic",
 *     location: "us-west1",
 *     project: project.then(project => project.projectId),
 *     description: "Test cluster",
 *     distribution: "aks",
 *     oidcConfig: {
 *         issuerUrl: "https://oidc.issuer.url",
 *     },
 *     platformVersion: versions.then(versions => versions.validVersions?.[0]),
 *     fleet: {
 *         project: project.then(project => `projects/${project.number}`),
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * versions = gcp.container.get_attached_versions(location="us-west1",
 *     project=project.project_id)
 * primary = gcp.container.AttachedCluster("primary",
 *     name="basic",
 *     location="us-west1",
 *     project=project.project_id,
 *     description="Test cluster",
 *     distribution="aks",
 *     oidc_config={
 *         "issuer_url": "https://oidc.issuer.url",
 *     },
 *     platform_version=versions.valid_versions[0],
 *     fleet={
 *         "project": f"projects/{project.number}",
 *     })
 * ```
 * ```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 versions = Gcp.Container.GetAttachedVersions.Invoke(new()
 *     {
 *         Location = "us-west1",
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *     });
 *     var primary = new Gcp.Container.AttachedCluster("primary", new()
 *     {
 *         Name = "basic",
 *         Location = "us-west1",
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *         Description = "Test cluster",
 *         Distribution = "aks",
 *         OidcConfig = new Gcp.Container.Inputs.AttachedClusterOidcConfigArgs
 *         {
 *             IssuerUrl = "https://oidc.issuer.url",
 *         },
 *         PlatformVersion = versions.Apply(getAttachedVersionsResult => getAttachedVersionsResult.ValidVersions[0]),
 *         Fleet = new Gcp.Container.Inputs.AttachedClusterFleetArgs
 *         {
 *             Project = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"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
 * 		}
 * 		versions, err := container.GetAttachedVersions(ctx, &container.GetAttachedVersionsArgs{
 * 			Location: "us-west1",
 * 			Project:  project.ProjectId,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = container.NewAttachedCluster(ctx, "primary", &container.AttachedClusterArgs{
 * 			Name:         pulumi.String("basic"),
 * 			Location:     pulumi.String("us-west1"),
 * 			Project:      pulumi.String(project.ProjectId),
 * 			Description:  pulumi.String("Test cluster"),
 * 			Distribution: pulumi.String("aks"),
 * 			OidcConfig: &container.AttachedClusterOidcConfigArgs{
 * 				IssuerUrl: pulumi.String("https://oidc.issuer.url"),
 * 			},
 * 			PlatformVersion: pulumi.String(versions.ValidVersions[0]),
 * 			Fleet: &container.AttachedClusterFleetArgs{
 * 				Project: pulumi.Sprintf("projects/%v", 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.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * import com.pulumi.gcp.container.ContainerFunctions;
 * import com.pulumi.gcp.container.inputs.GetAttachedVersionsArgs;
 * import com.pulumi.gcp.container.AttachedCluster;
 * import com.pulumi.gcp.container.AttachedClusterArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterOidcConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterFleetArgs;
 * 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();
 *         final var versions = ContainerFunctions.getAttachedVersions(GetAttachedVersionsArgs.builder()
 *             .location("us-west1")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .build());
 *         var primary = new AttachedCluster("primary", AttachedClusterArgs.builder()
 *             .name("basic")
 *             .location("us-west1")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .description("Test cluster")
 *             .distribution("aks")
 *             .oidcConfig(AttachedClusterOidcConfigArgs.builder()
 *                 .issuerUrl("https://oidc.issuer.url")
 *                 .build())
 *             .platformVersion(versions.applyValue(getAttachedVersionsResult -> getAttachedVersionsResult.validVersions()[0]))
 *             .fleet(AttachedClusterFleetArgs.builder()
 *                 .project(String.format("projects/%s", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   primary:
 *     type: gcp:container:AttachedCluster
 *     properties:
 *       name: basic
 *       location: us-west1
 *       project: ${project.projectId}
 *       description: Test cluster
 *       distribution: aks
 *       oidcConfig:
 *         issuerUrl: https://oidc.issuer.url
 *       platformVersion: ${versions.validVersions[0]}
 *       fleet:
 *         project: projects/${project.number}
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 *   versions:
 *     fn::invoke:
 *       Function: gcp:container:getAttachedVersions
 *       Arguments:
 *         location: us-west1
 *         project: ${project.projectId}
 * ```
 * 
 * ### Container Attached Cluster Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 * const project = gcp.organizations.getProject({});
 * const versions = project.then(project => gcp.container.getAttachedVersions({
 *     location: "us-west1",
 *     project: project.projectId,
 * }));
 * const primary = new gcp.container.AttachedCluster("primary", {
 *     name: "basic",
 *     project: project.then(project => project.projectId),
 *     location: "us-west1",
 *     description: "Test cluster",
 *     distribution: "aks",
 *     annotations: {
 *         "label-one": "value-one",
 *     },
 *     authorization: {
 *         adminUsers: [
 *             "[email protected]",
 *             "[email protected]",
 *         ],
 *         adminGroups: [
 *             "[email protected]",
 *             "[email protected]",
 *         ],
 *     },
 *     oidcConfig: {
 *         issuerUrl: "https://oidc.issuer.url",
 *         jwks: std.base64encode({
 *             input: "{\"keys\":[{\"use\":\"sig\",\"kty\":\"RSA\",\"kid\":\"testid\",\"alg\":\"RS256\",\"n\":\"somedata\",\"e\":\"AQAB\"}]}",
 *         }).then(invoke => invoke.result),
 *     },
 *     platformVersion: versions.then(versions => versions.validVersions?.[0]),
 *     fleet: {
 *         project: project.then(project => `projects/${project.number}`),
 *     },
 *     loggingConfig: {
 *         componentConfig: {
 *             enableComponents: [
 *                 "SYSTEM_COMPONENTS",
 *                 "WORKLOADS",
 *             ],
 *         },
 *     },
 *     monitoringConfig: {
 *         managedPrometheusConfig: {
 *             enabled: true,
 *         },
 *     },
 *     binaryAuthorization: {
 *         evaluationMode: "PROJECT_SINGLETON_POLICY_ENFORCE",
 *     },
 *     proxyConfig: {
 *         kubernetesSecret: {
 *             name: "proxy-config",
 *             namespace: "default",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_std as std
 * project = gcp.organizations.get_project()
 * versions = gcp.container.get_attached_versions(location="us-west1",
 *     project=project.project_id)
 * primary = gcp.container.AttachedCluster("primary",
 *     name="basic",
 *     project=project.project_id,
 *     location="us-west1",
 *     description="Test cluster",
 *     distribution="aks",
 *     annotations={
 *         "label-one": "value-one",
 *     },
 *     authorization={
 *         "admin_users": [
 *             "[email protected]",
 *             "[email protected]",
 *         ],
 *         "admin_groups": [
 *             "[email protected]",
 *             "[email protected]",
 *         ],
 *     },
 *     oidc_config={
 *         "issuer_url": "https://oidc.issuer.url",
 *         "jwks": std.base64encode(input="{\"keys\":[{\"use\":\"sig\",\"kty\":\"RSA\",\"kid\":\"testid\",\"alg\":\"RS256\",\"n\":\"somedata\",\"e\":\"AQAB\"}]}").result,
 *     },
 *     platform_version=versions.valid_versions[0],
 *     fleet={
 *         "project": f"projects/{project.number}",
 *     },
 *     logging_config={
 *         "component_config": {
 *             "enable_components": [
 *                 "SYSTEM_COMPONENTS",
 *                 "WORKLOADS",
 *             ],
 *         },
 *     },
 *     monitoring_config={
 *         "managed_prometheus_config": {
 *             "enabled": True,
 *         },
 *     },
 *     binary_authorization={
 *         "evaluation_mode": "PROJECT_SINGLETON_POLICY_ENFORCE",
 *     },
 *     proxy_config={
 *         "kubernetes_secret": {
 *             "name": "proxy-config",
 *             "namespace": "default",
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var project = Gcp.Organizations.GetProject.Invoke();
 *     var versions = Gcp.Container.GetAttachedVersions.Invoke(new()
 *     {
 *         Location = "us-west1",
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *     });
 *     var primary = new Gcp.Container.AttachedCluster("primary", new()
 *     {
 *         Name = "basic",
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *         Location = "us-west1",
 *         Description = "Test cluster",
 *         Distribution = "aks",
 *         Annotations =
 *         {
 *             { "label-one", "value-one" },
 *         },
 *         Authorization = new Gcp.Container.Inputs.AttachedClusterAuthorizationArgs
 *         {
 *             AdminUsers = new[]
 *             {
 *                 "[email protected]",
 *                 "[email protected]",
 *             },
 *             AdminGroups = new[]
 *             {
 *                 "[email protected]",
 *                 "[email protected]",
 *             },
 *         },
 *         OidcConfig = new Gcp.Container.Inputs.AttachedClusterOidcConfigArgs
 *         {
 *             IssuerUrl = "https://oidc.issuer.url",
 *             Jwks = Std.Base64encode.Invoke(new()
 *             {
 *                 Input = "{\"keys\":[{\"use\":\"sig\",\"kty\":\"RSA\",\"kid\":\"testid\",\"alg\":\"RS256\",\"n\":\"somedata\",\"e\":\"AQAB\"}]}",
 *             }).Apply(invoke => invoke.Result),
 *         },
 *         PlatformVersion = versions.Apply(getAttachedVersionsResult => getAttachedVersionsResult.ValidVersions[0]),
 *         Fleet = new Gcp.Container.Inputs.AttachedClusterFleetArgs
 *         {
 *             Project = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
 *         },
 *         LoggingConfig = new Gcp.Container.Inputs.AttachedClusterLoggingConfigArgs
 *         {
 *             ComponentConfig = new Gcp.Container.Inputs.AttachedClusterLoggingConfigComponentConfigArgs
 *             {
 *                 EnableComponents = new[]
 *                 {
 *                     "SYSTEM_COMPONENTS",
 *                     "WORKLOADS",
 *                 },
 *             },
 *         },
 *         MonitoringConfig = new Gcp.Container.Inputs.AttachedClusterMonitoringConfigArgs
 *         {
 *             ManagedPrometheusConfig = new Gcp.Container.Inputs.AttachedClusterMonitoringConfigManagedPrometheusConfigArgs
 *             {
 *                 Enabled = true,
 *             },
 *         },
 *         BinaryAuthorization = new Gcp.Container.Inputs.AttachedClusterBinaryAuthorizationArgs
 *         {
 *             EvaluationMode = "PROJECT_SINGLETON_POLICY_ENFORCE",
 *         },
 *         ProxyConfig = new Gcp.Container.Inputs.AttachedClusterProxyConfigArgs
 *         {
 *             KubernetesSecret = new Gcp.Container.Inputs.AttachedClusterProxyConfigKubernetesSecretArgs
 *             {
 *                 Name = "proxy-config",
 *                 Namespace = "default",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"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
 * 		}
 * 		versions, err := container.GetAttachedVersions(ctx, &container.GetAttachedVersionsArgs{
 * 			Location: "us-west1",
 * 			Project:  project.ProjectId,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
 * 			Input: "{\"keys\":[{\"use\":\"sig\",\"kty\":\"RSA\",\"kid\":\"testid\",\"alg\":\"RS256\",\"n\":\"somedata\",\"e\":\"AQAB\"}]}",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = container.NewAttachedCluster(ctx, "primary", &container.AttachedClusterArgs{
 * 			Name:         pulumi.String("basic"),
 * 			Project:      pulumi.String(project.ProjectId),
 * 			Location:     pulumi.String("us-west1"),
 * 			Description:  pulumi.String("Test cluster"),
 * 			Distribution: pulumi.String("aks"),
 * 			Annotations: pulumi.StringMap{
 * 				"label-one": pulumi.String("value-one"),
 * 			},
 * 			Authorization: &container.AttachedClusterAuthorizationArgs{
 * 				AdminUsers: pulumi.StringArray{
 * 					pulumi.String("[email protected]"),
 * 					pulumi.String("[email protected]"),
 * 				},
 * 				AdminGroups: pulumi.StringArray{
 * 					pulumi.String("[email protected]"),
 * 					pulumi.String("[email protected]"),
 * 				},
 * 			},
 * 			OidcConfig: &container.AttachedClusterOidcConfigArgs{
 * 				IssuerUrl: pulumi.String("https://oidc.issuer.url"),
 * 				Jwks:      pulumi.String(invokeBase64encode.Result),
 * 			},
 * 			PlatformVersion: pulumi.String(versions.ValidVersions[0]),
 * 			Fleet: &container.AttachedClusterFleetArgs{
 * 				Project: pulumi.Sprintf("projects/%v", project.Number),
 * 			},
 * 			LoggingConfig: &container.AttachedClusterLoggingConfigArgs{
 * 				ComponentConfig: &container.AttachedClusterLoggingConfigComponentConfigArgs{
 * 					EnableComponents: pulumi.StringArray{
 * 						pulumi.String("SYSTEM_COMPONENTS"),
 * 						pulumi.String("WORKLOADS"),
 * 					},
 * 				},
 * 			},
 * 			MonitoringConfig: &container.AttachedClusterMonitoringConfigArgs{
 * 				ManagedPrometheusConfig: &container.AttachedClusterMonitoringConfigManagedPrometheusConfigArgs{
 * 					Enabled: pulumi.Bool(true),
 * 				},
 * 			},
 * 			BinaryAuthorization: &container.AttachedClusterBinaryAuthorizationArgs{
 * 				EvaluationMode: pulumi.String("PROJECT_SINGLETON_POLICY_ENFORCE"),
 * 			},
 * 			ProxyConfig: &container.AttachedClusterProxyConfigArgs{
 * 				KubernetesSecret: &container.AttachedClusterProxyConfigKubernetesSecretArgs{
 * 					Name:      pulumi.String("proxy-config"),
 * 					Namespace: pulumi.String("default"),
 * 				},
 * 			},
 * 		})
 * 		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.container.ContainerFunctions;
 * import com.pulumi.gcp.container.inputs.GetAttachedVersionsArgs;
 * import com.pulumi.gcp.container.AttachedCluster;
 * import com.pulumi.gcp.container.AttachedClusterArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterAuthorizationArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterOidcConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterFleetArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterLoggingConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterLoggingConfigComponentConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterMonitoringConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterMonitoringConfigManagedPrometheusConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterBinaryAuthorizationArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterProxyConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterProxyConfigKubernetesSecretArgs;
 * 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();
 *         final var versions = ContainerFunctions.getAttachedVersions(GetAttachedVersionsArgs.builder()
 *             .location("us-west1")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .build());
 *         var primary = new AttachedCluster("primary", AttachedClusterArgs.builder()
 *             .name("basic")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .location("us-west1")
 *             .description("Test cluster")
 *             .distribution("aks")
 *             .annotations(Map.of("label-one", "value-one"))
 *             .authorization(AttachedClusterAuthorizationArgs.builder()
 *                 .adminUsers(
 *                     "[email protected]",
 *                     "[email protected]")
 *                 .adminGroups(
 *                     "[email protected]",
 *                     "[email protected]")
 *                 .build())
 *             .oidcConfig(AttachedClusterOidcConfigArgs.builder()
 *                 .issuerUrl("https://oidc.issuer.url")
 *                 .jwks(StdFunctions.base64encode(Base64encodeArgs.builder()
 *                     .input("{\"keys\":[{\"use\":\"sig\",\"kty\":\"RSA\",\"kid\":\"testid\",\"alg\":\"RS256\",\"n\":\"somedata\",\"e\":\"AQAB\"}]}")
 *                     .build()).result())
 *                 .build())
 *             .platformVersion(versions.applyValue(getAttachedVersionsResult -> getAttachedVersionsResult.validVersions()[0]))
 *             .fleet(AttachedClusterFleetArgs.builder()
 *                 .project(String.format("projects/%s", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                 .build())
 *             .loggingConfig(AttachedClusterLoggingConfigArgs.builder()
 *                 .componentConfig(AttachedClusterLoggingConfigComponentConfigArgs.builder()
 *                     .enableComponents(
 *                         "SYSTEM_COMPONENTS",
 *                         "WORKLOADS")
 *                     .build())
 *                 .build())
 *             .monitoringConfig(AttachedClusterMonitoringConfigArgs.builder()
 *                 .managedPrometheusConfig(AttachedClusterMonitoringConfigManagedPrometheusConfigArgs.builder()
 *                     .enabled(true)
 *                     .build())
 *                 .build())
 *             .binaryAuthorization(AttachedClusterBinaryAuthorizationArgs.builder()
 *                 .evaluationMode("PROJECT_SINGLETON_POLICY_ENFORCE")
 *                 .build())
 *             .proxyConfig(AttachedClusterProxyConfigArgs.builder()
 *                 .kubernetesSecret(AttachedClusterProxyConfigKubernetesSecretArgs.builder()
 *                     .name("proxy-config")
 *                     .namespace("default")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   primary:
 *     type: gcp:container:AttachedCluster
 *     properties:
 *       name: basic
 *       project: ${project.projectId}
 *       location: us-west1
 *       description: Test cluster
 *       distribution: aks
 *       annotations:
 *         label-one: value-one
 *       authorization:
 *         adminUsers:
 *           - [email protected]
 *           - [email protected]
 *         adminGroups:
 *           - [email protected]
 *           - [email protected]
 *       oidcConfig:
 *         issuerUrl: https://oidc.issuer.url
 *         jwks:
 *           fn::invoke:
 *             Function: std:base64encode
 *             Arguments:
 *               input: '{"keys":[{"use":"sig","kty":"RSA","kid":"testid","alg":"RS256","n":"somedata","e":"AQAB"}]}'
 *             Return: result
 *       platformVersion: ${versions.validVersions[0]}
 *       fleet:
 *         project: projects/${project.number}
 *       loggingConfig:
 *         componentConfig:
 *           enableComponents:
 *             - SYSTEM_COMPONENTS
 *             - WORKLOADS
 *       monitoringConfig:
 *         managedPrometheusConfig:
 *           enabled: true
 *       binaryAuthorization:
 *         evaluationMode: PROJECT_SINGLETON_POLICY_ENFORCE
 *       proxyConfig:
 *         kubernetesSecret:
 *           name: proxy-config
 *           namespace: default
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 *   versions:
 *     fn::invoke:
 *       Function: gcp:container:getAttachedVersions
 *       Arguments:
 *         location: us-west1
 *         project: ${project.projectId}
 * ```
 * 
 * ### Container Attached Cluster Ignore Errors
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const project = gcp.organizations.getProject({});
 * const versions = project.then(project => gcp.container.getAttachedVersions({
 *     location: "us-west1",
 *     project: project.projectId,
 * }));
 * const primary = new gcp.container.AttachedCluster("primary", {
 *     name: "basic",
 *     location: "us-west1",
 *     project: project.then(project => project.projectId),
 *     description: "Test cluster",
 *     distribution: "aks",
 *     oidcConfig: {
 *         issuerUrl: "https://oidc.issuer.url",
 *     },
 *     platformVersion: versions.then(versions => versions.validVersions?.[0]),
 *     fleet: {
 *         project: project.then(project => `projects/${project.number}`),
 *     },
 *     deletionPolicy: "DELETE_IGNORE_ERRORS",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * project = gcp.organizations.get_project()
 * versions = gcp.container.get_attached_versions(location="us-west1",
 *     project=project.project_id)
 * primary = gcp.container.AttachedCluster("primary",
 *     name="basic",
 *     location="us-west1",
 *     project=project.project_id,
 *     description="Test cluster",
 *     distribution="aks",
 *     oidc_config={
 *         "issuer_url": "https://oidc.issuer.url",
 *     },
 *     platform_version=versions.valid_versions[0],
 *     fleet={
 *         "project": f"projects/{project.number}",
 *     },
 *     deletion_policy="DELETE_IGNORE_ERRORS")
 * ```
 * ```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 versions = Gcp.Container.GetAttachedVersions.Invoke(new()
 *     {
 *         Location = "us-west1",
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *     });
 *     var primary = new Gcp.Container.AttachedCluster("primary", new()
 *     {
 *         Name = "basic",
 *         Location = "us-west1",
 *         Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
 *         Description = "Test cluster",
 *         Distribution = "aks",
 *         OidcConfig = new Gcp.Container.Inputs.AttachedClusterOidcConfigArgs
 *         {
 *             IssuerUrl = "https://oidc.issuer.url",
 *         },
 *         PlatformVersion = versions.Apply(getAttachedVersionsResult => getAttachedVersionsResult.ValidVersions[0]),
 *         Fleet = new Gcp.Container.Inputs.AttachedClusterFleetArgs
 *         {
 *             Project = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
 *         },
 *         DeletionPolicy = "DELETE_IGNORE_ERRORS",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
 * 	"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
 * 		}
 * 		versions, err := container.GetAttachedVersions(ctx, &container.GetAttachedVersionsArgs{
 * 			Location: "us-west1",
 * 			Project:  project.ProjectId,
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = container.NewAttachedCluster(ctx, "primary", &container.AttachedClusterArgs{
 * 			Name:         pulumi.String("basic"),
 * 			Location:     pulumi.String("us-west1"),
 * 			Project:      pulumi.String(project.ProjectId),
 * 			Description:  pulumi.String("Test cluster"),
 * 			Distribution: pulumi.String("aks"),
 * 			OidcConfig: &container.AttachedClusterOidcConfigArgs{
 * 				IssuerUrl: pulumi.String("https://oidc.issuer.url"),
 * 			},
 * 			PlatformVersion: pulumi.String(versions.ValidVersions[0]),
 * 			Fleet: &container.AttachedClusterFleetArgs{
 * 				Project: pulumi.Sprintf("projects/%v", project.Number),
 * 			},
 * 			DeletionPolicy: pulumi.String("DELETE_IGNORE_ERRORS"),
 * 		})
 * 		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.container.ContainerFunctions;
 * import com.pulumi.gcp.container.inputs.GetAttachedVersionsArgs;
 * import com.pulumi.gcp.container.AttachedCluster;
 * import com.pulumi.gcp.container.AttachedClusterArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterOidcConfigArgs;
 * import com.pulumi.gcp.container.inputs.AttachedClusterFleetArgs;
 * 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();
 *         final var versions = ContainerFunctions.getAttachedVersions(GetAttachedVersionsArgs.builder()
 *             .location("us-west1")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .build());
 *         var primary = new AttachedCluster("primary", AttachedClusterArgs.builder()
 *             .name("basic")
 *             .location("us-west1")
 *             .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
 *             .description("Test cluster")
 *             .distribution("aks")
 *             .oidcConfig(AttachedClusterOidcConfigArgs.builder()
 *                 .issuerUrl("https://oidc.issuer.url")
 *                 .build())
 *             .platformVersion(versions.applyValue(getAttachedVersionsResult -> getAttachedVersionsResult.validVersions()[0]))
 *             .fleet(AttachedClusterFleetArgs.builder()
 *                 .project(String.format("projects/%s", project.applyValue(getProjectResult -> getProjectResult.number())))
 *                 .build())
 *             .deletionPolicy("DELETE_IGNORE_ERRORS")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   primary:
 *     type: gcp:container:AttachedCluster
 *     properties:
 *       name: basic
 *       location: us-west1
 *       project: ${project.projectId}
 *       description: Test cluster
 *       distribution: aks
 *       oidcConfig:
 *         issuerUrl: https://oidc.issuer.url
 *       platformVersion: ${versions.validVersions[0]}
 *       fleet:
 *         project: projects/${project.number}
 *       deletionPolicy: DELETE_IGNORE_ERRORS
 * variables:
 *   project:
 *     fn::invoke:
 *       Function: gcp:organizations:getProject
 *       Arguments: {}
 *   versions:
 *     fn::invoke:
 *       Function: gcp:container:getAttachedVersions
 *       Arguments:
 *         location: us-west1
 *         project: ${project.projectId}
 * ```
 * 
 * ## Import
 * Cluster can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/attachedClusters/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, Cluster can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:container/attachedCluster:AttachedCluster default projects/{{project}}/locations/{{location}}/attachedClusters/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:container/attachedCluster:AttachedCluster default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:container/attachedCluster:AttachedCluster default {{location}}/{{name}}
 * ```
 */
public class AttachedCluster internal constructor(
    override val javaResource: com.pulumi.gcp.container.AttachedCluster,
) : KotlinCustomResource(javaResource, AttachedClusterMapper) {
    /**
     * Optional. Annotations on the cluster. This field has the same restrictions as Kubernetes annotations. The total size of
     * all keys and values combined is limited to 256k. Key can have 2 segments: prefix (optional) and name (required),
     * separated by a slash (/). Prefix must be a DNS subdomain. Name must be 63 characters or less, begin and end with
     * alphanumerics, with dashes (-), underscores (_), dots (.), and alphanumerics between. **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>?
        get() = javaResource.annotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Configuration related to the cluster RBAC settings.
     */
    public val authorization: Output?
        get() = javaResource.authorization().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> attachedClusterAuthorizationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Binary Authorization configuration.
     */
    public val binaryAuthorization: Output
        get() = javaResource.binaryAuthorization().applyValue({ args0 ->
            args0.let({ args0 ->
                attachedClusterBinaryAuthorizationToKotlin(args0)
            })
        })

    /**
     * Output only. The region where this cluster runs.
     * For EKS clusters, this is an AWS region. For AKS clusters,
     * this is an Azure region.
     */
    public val clusterRegion: Output
        get() = javaResource.clusterRegion().applyValue({ args0 -> args0 })

    /**
     * Output only. The time at which this cluster was created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Policy to determine what flags to send on delete.
     */
    public val deletionPolicy: Output?
        get() = javaResource.deletionPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A human readable description of this attached cluster. Cannot be longer than 255 UTF-8 encoded bytes.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Kubernetes distribution of the underlying attached cluster. Supported values:
     * "eks", "aks", "generic". The generic distribution provides the ability to register
     * or migrate any CNCF conformant cluster.
     */
    public val distribution: Output
        get() = javaResource.distribution().applyValue({ args0 -> args0 })

    public val effectiveAnnotations: Output>
        get() = javaResource.effectiveAnnotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * A set of errors found in the cluster.
     * Structure is documented below.
     */
    public val errors: Output>
        get() = javaResource.errors().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    attachedClusterErrorToKotlin(args0)
                })
            })
        })

    /**
     * Fleet configuration.
     * Structure is documented below.
     */
    public val fleet: Output
        get() = javaResource.fleet().applyValue({ args0 ->
            args0.let({ args0 ->
                attachedClusterFleetToKotlin(args0)
            })
        })

    /**
     * The Kubernetes version of the cluster.
     */
    public val kubernetesVersion: Output
        get() = javaResource.kubernetesVersion().applyValue({ args0 -> args0 })

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

    /**
     * Logging configuration.
     */
    public val loggingConfig: Output?
        get() = javaResource.loggingConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> attachedClusterLoggingConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Monitoring configuration.
     */
    public val monitoringConfig: Output
        get() = javaResource.monitoringConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                attachedClusterMonitoringConfigToKotlin(args0)
            })
        })

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

    /**
     * OIDC discovery information of the target cluster.
     * Kubernetes Service Account (KSA) tokens are JWT tokens signed by the cluster
     * API server. This fields indicates how GCP services
     * validate KSA tokens in order to allow system workloads (such as GKE Connect
     * and telemetry agents) to authenticate back to GCP.
     * Both clusters with public and private issuer URLs are supported.
     * Clusters with public issuers only need to specify the `issuer_url` field
     * while clusters with private issuers need to provide both
     * `issuer_url` and `jwks`.
     * Structure is documented below.
     */
    public val oidcConfig: Output
        get() = javaResource.oidcConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                attachedClusterOidcConfigToKotlin(args0)
            })
        })

    /**
     * The platform version for the cluster (e.g. `1.23.0-gke.1`).
     */
    public val platformVersion: Output
        get() = javaResource.platformVersion().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Support for proxy configuration.
     */
    public val proxyConfig: Output?
        get() = javaResource.proxyConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    attachedClusterProxyConfigToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * If set, there are currently changes in flight to the cluster.
     */
    public val reconciling: Output
        get() = javaResource.reconciling().applyValue({ args0 -> args0 })

    /**
     * The current state of the cluster. Possible values:
     * STATE_UNSPECIFIED, PROVISIONING, RUNNING, RECONCILING, STOPPING, ERROR,
     * DEGRADED
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * A globally unique identifier for the cluster.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * The time at which this cluster was last updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })

    /**
     * Workload Identity settings.
     * Structure is documented below.
     */
    public val workloadIdentityConfigs: Output>
        get() = javaResource.workloadIdentityConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> attachedClusterWorkloadIdentityConfigToKotlin(args0) })
            })
        })
}

public object AttachedClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.container.AttachedCluster::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy