# 

# exoscale_sks_cluster (Resource)

Manage Exoscale [Scalable Kubernetes Service (SKS)](https://community.exoscale.com/product/compute/containers/) Clusters.

## Example Usage

```terraform
resource "exoscale_sks_cluster" "my_sks_cluster" {
  zone = "ch-gva-2"
  name = "my-sks-cluster"
}

output "my_sks_cluster_endpoint" {
  value = exoscale_sks_cluster.my_sks_cluster.endpoint
}
```

Next step is to attach [exoscale_sks_nodepool]({{< ref "./sks_nodepool.md" >}})(s) to the cluster.

Please refer to the [examples](https://github.com/exoscale/terraform-provider-exoscale/tree/master/examples/)
directory for complete configuration examples.

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The SKS cluster name.
- `zone` (String) ❗ The Exoscale [Zone](https://www.exoscale.com/datacenters/) name.

### Optional

- `addons` (Set of String, Deprecated)
- `audit` (Block List, Max: 1) Parameters for Kubernetes Audit configuration (may only be enabled at creation time) (see [below for nested schema](#nestedblock--audit))
- `auto_upgrade` (Boolean) Enable automatic upgrading of the control plane version.
- `cni` (String) The CNI plugin that is to be used. Available options are "calico" or "cilium". Defaults to "calico". Setting empty string will result in a cluster with no CNI.
- `create_default_security_group` (Boolean) ❗ Creates an ad-hoc security group based on the choice of the selected CNI (may only be set at creation time).
- `description` (String) A free-form text describing the cluster.
- `enable_karpenter` (Boolean) Indicates whether to deploy Karpenter for cluster autoscaling.
- `enable_kube_proxy` (Boolean) ❗ Indicates whether to deploy the Kubernetes network proxy. (may only be set at creation time)
- `exoscale_ccm` (Boolean) Deploy the Exoscale [Cloud Controller Manager](https://github.com/exoscale/exoscale-cloud-controller-manager/) in the control plane (boolean; default: `true`; may only be set at creation time).
- `exoscale_csi` (Boolean) Deploy the Exoscale [Container Storage Interface](https://github.com/exoscale/exoscale-csi-driver/) on worker nodes (boolean; default: `false`; requires the CCM to be enabled).
- `feature_gates` (Set of String) Feature gates options for the cluster.
- `labels` (Map of String) A map of key/value labels.
- `metrics_server` (Boolean) Deploy the [Kubernetes Metrics Server](https://github.com/kubernetes-sigs/metrics-server/) in the control plane (boolean; default: `true`; may only be set at creation time).
- `oidc` (Block List, Max: 1) An OpenID Connect configuration to provide to the Kubernetes API server (may only be set at creation time). Structure is documented below. (see [below for nested schema](#nestedblock--oidc))
- `service_level` (String) The service level of the control plane (`pro` or `starter`; default: `pro`; may only be set at creation time).
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `version` (String) The version of the control plane (default: latest version available from the API; see `exo compute sks versions` for reference; may only be set at creation time).

### Read-Only

- `aggregation_ca` (String, Sensitive) The CA certificate (in PEM format) for TLS communications between the control plane and the aggregation layer (e.g. `metrics-server`).
- `control_plane_ca` (String, Sensitive) The CA certificate (in PEM format) for TLS communications between control plane components.
- `created_at` (String) The cluster creation date.
- `default_security_group_id` (String) The ID of the cluster's ad-hoc default security group (when `create_default_security_group` was set at creation time).
- `endpoint` (String) The cluster API endpoint.
- `id` (String) The SKS cluster ID.
- `kubelet_ca` (String, Sensitive) The CA certificate (in PEM format) for TLS communications between kubelets and the control plane.
- `nodepools` (Set of String) The list of [exoscale_sks_nodepool]({{< ref "./sks_nodepool.md" >}}) (IDs) attached to the cluster.
- `state` (String) The cluster state.

<a id="nestedblock--audit"></a>
### Nested Schema for `audit`

Optional:

- `bearer_token` (String, Sensitive) The optional bearer token to include in the request header
- `enabled` (Boolean) Whether to run the APIServer with the configured Kubernetes Audit
- `endpoint` (String) The Endpoint URL for the Webserver responsible of processing Audit events
- `initial_backoff` (String) The Initial Backoff to wait before sending data to the remote server (default '10s')


<a id="nestedblock--oidc"></a>
### Nested Schema for `oidc`

Required:

- `client_id` (String) The OpenID client ID.
- `issuer_url` (String) The OpenID provider URL.

Optional:

- `groups_claim` (String) An OpenID JWT claim to use as the user's group.
- `groups_prefix` (String) An OpenID prefix prepended to group claims.
- `required_claim` (Map of String) A map of key/value pairs that describes a required claim in the OpenID Token.
- `username_claim` (String) An OpenID JWT claim to use as the user name.
- `username_prefix` (String) An OpenID prefix prepended to username claims.


<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `create` (String)
- `delete` (String)
- `read` (String)
- `update` (String)

-> The symbol ❗ in an attribute indicates that modifying it, will force the creation of a new resource.

## Import

An existing SKS cluster may be imported by `<ID>@<zone>`:

```shell
terraform import \
  exoscale_sks_cluster.my_sks_cluster \
  f81d4fae-7dec-11d0-a765-00a0c91e6bf6@ch-gva-2
```

~> **NOTE:** Importing an `exoscale_sks_cluster` resource does _not_ import related `exoscale_sks_nodepool` resources.

