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

com.pulumi.digitalocean.kotlin.KubernetesCluster.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 4.38.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.digitalocean.kotlin

import com.pulumi.core.Output
import com.pulumi.digitalocean.kotlin.outputs.KubernetesClusterKubeConfig
import com.pulumi.digitalocean.kotlin.outputs.KubernetesClusterMaintenancePolicy
import com.pulumi.digitalocean.kotlin.outputs.KubernetesClusterNodePool
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 com.pulumi.digitalocean.kotlin.outputs.KubernetesClusterKubeConfig.Companion.toKotlin as kubernetesClusterKubeConfigToKotlin
import com.pulumi.digitalocean.kotlin.outputs.KubernetesClusterMaintenancePolicy.Companion.toKotlin as kubernetesClusterMaintenancePolicyToKotlin
import com.pulumi.digitalocean.kotlin.outputs.KubernetesClusterNodePool.Companion.toKotlin as kubernetesClusterNodePoolToKotlin

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

    public var args: KubernetesClusterArgs = KubernetesClusterArgs()

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

/**
 *
 * ## Import
 * Before importing a Kubernetes cluster, the cluster's default node pool must be tagged with
 * the `terraform:default-node-pool` tag. The provider will automatically add this tag if
 * the cluster only has a single node pool. Clusters with more than one node pool, however, will require
 * that you manually add the `terraform:default-node-pool` tag to the node pool that you intend to be
 * the default node pool.
 * Then the Kubernetes cluster and its default node pool can be imported using the cluster's `id`, e.g.
 * ```sh
 * $ pulumi import digitalocean:index/kubernetesCluster:KubernetesCluster mycluster 1b8b2100-0e9f-4e8f-ad78-9eb578c2a0af
 * ```
 * Additional node pools must be imported separately as `digitalocean_kubernetes_cluster`
 * resources, e.g.
 * ```sh
 * $ pulumi import digitalocean:index/kubernetesCluster:KubernetesCluster mynodepool 9d76f410-9284-4436-9633-4066852442c8
 * ```
 */
public class KubernetesCluster internal constructor(
    override val javaResource: com.pulumi.digitalocean.KubernetesCluster,
) : KotlinCustomResource(javaResource, KubernetesClusterMapper) {
    /**
     * A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window.
     */
    public val autoUpgrade: Output?
        get() = javaResource.autoUpgrade().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The range of IP addresses in the overlay network of the Kubernetes cluster.
     */
    public val clusterSubnet: Output
        get() = javaResource.clusterSubnet().applyValue({ args0 -> args0 })

    /**
     * The uniform resource name (URN) for the Kubernetes cluster.
     */
    public val clusterUrn: Output
        get() = javaResource.clusterUrn().applyValue({ args0 -> args0 })

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

    /**
     * **Use with caution.** When set to true, all associated DigitalOcean resources created via the Kubernetes API (load balancers, volumes, and volume snapshots) will be destroyed along with the cluster when it is destroyed.
     * This resource supports customized create timeouts. The default timeout is 30 minutes.
     */
    public val destroyAllAssociatedResources: Output?
        get() = javaResource.destroyAllAssociatedResources().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The base URL of the API server on the Kubernetes master node.
     */
    public val endpoint: Output
        get() = javaResource.endpoint().applyValue({ args0 -> args0 })

    /**
     * Enable/disable the high availability control plane for a cluster. Once enabled for a cluster, high availability cannot be disabled. Default: false
     */
    public val ha: Output?
        get() = javaResource.ha().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The public IPv4 address of the Kubernetes master node. This will not be set if high availability is configured on the cluster (v1.21+)
     */
    public val ipv4Address: Output
        get() = javaResource.ipv4Address().applyValue({ args0 -> args0 })

    /**
     * A representation of the Kubernetes cluster's kubeconfig with the following attributes:
     */
    public val kubeConfigs: Output>
        get() = javaResource.kubeConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    kubernetesClusterKubeConfigToKotlin(args0)
                })
            })
        })

    /**
     * A block representing the cluster's maintenance window. Updates will be applied within this window. If not specified, a default maintenance window will be chosen. `auto_upgrade` must be set to `true` for this to have an effect.
     */
    public val maintenancePolicy: Output
        get() = javaResource.maintenancePolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                kubernetesClusterMaintenancePolicyToKotlin(args0)
            })
        })

    /**
     * A name for the Kubernetes cluster.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * A block representing the cluster's default node pool. Additional node pools may be added to the cluster using the `digitalocean.KubernetesNodePool` resource. The following arguments may be specified:
     */
    public val nodePool: Output
        get() = javaResource.nodePool().applyValue({ args0 ->
            args0.let({ args0 ->
                kubernetesClusterNodePoolToKotlin(args0)
            })
        })

    /**
     * The slug identifier for the region where the Kubernetes cluster will be created.
     */
    public val region: Output
        get() = javaResource.region().applyValue({ args0 -> args0 })

    /**
     * Enables or disables the DigitalOcean container registry integration for the cluster. This requires that a container registry has first been created for the account. Default: false
     */
    public val registryIntegration: Output?
        get() = javaResource.registryIntegration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The range of assignable IP addresses for services running in the Kubernetes cluster.
     */
    public val serviceSubnet: Output
        get() = javaResource.serviceSubnet().applyValue({ args0 -> args0 })

    /**
     * A string indicating the current status of the individual node.
     */
    public val status: Output
        get() = javaResource.status().applyValue({ args0 -> args0 })

    /**
     * Enable/disable surge upgrades for a cluster. Default: true
     */
    public val surgeUpgrade: Output?
        get() = javaResource.surgeUpgrade().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A list of tag names to be applied to the Kubernetes cluster.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

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

    /**
     * The slug identifier for the version of Kubernetes used for the cluster. Use [doctl](https://github.com/digitalocean/doctl) to find the available versions `doctl kubernetes options versions`. (**Note:** A cluster may only be upgraded to newer versions in-place. If the version is decreased, a new resource will be created.)
     */
    public val version: Output
        get() = javaResource.version().applyValue({ args0 -> args0 })

    /**
     * The ID of the VPC where the Kubernetes cluster will be located.
     */
    public val vpcUuid: Output
        get() = javaResource.vpcUuid().applyValue({ args0 -> args0 })
}

public object KubernetesClusterMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.digitalocean.KubernetesCluster::class == javaResource::class

    override fun map(javaResource: Resource): KubernetesCluster = KubernetesCluster(
        javaResource as
            com.pulumi.digitalocean.KubernetesCluster,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy