Deprecate kubeconfig field and add stackit_ske_kubeconfig resource (#256)

* Implement kubeconfig resource

* Update acc test, skip get credentials

* Update acc test

* Add warning on Create

* Add option to refresh

* Fix lint

* Add comment, generate docs

* Update stackit/internal/services/ske/cluster/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* Update stackit/internal/services/ske/kubeconfig/resource.go

Co-authored-by: João Palet <joao.palet@outlook.com>

* Changes after review

* Fix schema

* Gen docs

* Rename

* Credentials handling in datasource, update acc test

* Fix datasource

* Update descriptions

---------

Co-authored-by: João Palet <joao.palet@outlook.com>
This commit is contained in:
Vicente Pinto 2024-02-09 10:17:04 +00:00 committed by GitHub
parent 91b2c42a19
commit bde1fc55e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 618 additions and 39 deletions

View file

@ -35,7 +35,7 @@ This should be used with care since it also disables a couple of other features
- `extensions` (Attributes) A single extensions block as defined below (see [below for nested schema](#nestedatt--extensions))
- `hibernations` (Attributes List) One or more hibernation block as defined below. (see [below for nested schema](#nestedatt--hibernations))
- `id` (String) Terraform's internal data source. ID. It is structured as "`project_id`,`name`".
- `kube_config` (String, Sensitive) Kube config file used for connecting to the cluster
- `kube_config` (String, Sensitive, Deprecated) Kube config file used for connecting to the cluster. This field will be empty for clusters with Kubernetes v1.27+, or if you have obtained the kubeconfig or performed credentials rotation using the new process, either through the Portal or the SKE API. Use the stackit_ske_kubeconfig resource instead. For more information, see How to rotate SKE credentials (https://docs.stackit.cloud/stackit/en/how-to-rotate-ske-credentials-200016334.html).
- `kubernetes_version` (String) Kubernetes version.
- `kubernetes_version_used` (String) Full Kubernetes version used. For example, if `1.22` was selected, this value may result to `1.22.15`
- `maintenance` (Attributes) A single maintenance block as defined below (see [below for nested schema](#nestedatt--maintenance))

View file

@ -58,7 +58,7 @@ Deprecated as of Kubernetes 1.25 and later
### Read-Only
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`name`".
- `kube_config` (String, Sensitive) Kube config file used for connecting to the cluster
- `kube_config` (String, Sensitive, Deprecated) Static token kubeconfig used for connecting to the cluster. This field will be empty for clusters with Kubernetes v1.27+, or if you have obtained the kubeconfig or performed credentials rotation using the new process, either through the Portal or the SKE API. Use the stackit_ske_kubeconfig resource instead. For more information, see How to rotate SKE credentials (https://docs.stackit.cloud/stackit/en/how-to-rotate-ske-credentials-200016334.html).
- `kubernetes_version_used` (String) Full Kubernetes version used. For example, if 1.22 was selected, this value may result to 1.22.15
<a id="nestedatt--node_pools"></a>

View file

@ -0,0 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_ske_kubeconfig Resource - stackit"
subcategory: ""
description: |-
SKE kubeconfig resource schema. Must have a region specified in the provider configuration.
---
# stackit_ske_kubeconfig (Resource)
SKE kubeconfig resource schema. Must have a `region` specified in the provider configuration.
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `cluster_name` (String) Name of the SKE cluster.
- `project_id` (String) STACKIT project ID to which the cluster is associated.
### Optional
- `expiration` (Number) Expiration time of the kubeconfig, in seconds.
- `refresh` (Boolean) If set to true, the provider will check if the kubeconfig has expired and will generated a new valid one in-place
### Read-Only
- `expires_at` (String) Timestamp when the kubeconfig expires
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`cluster_name`,`kube_config_id`".
- `kube_config` (String, Sensitive) Raw short-lived admin kubeconfig.
- `kube_config_id` (String) Internally generated UUID to identify a kubeconfig resource in Terraform, since the SKE API doesnt return a kubeconfig identifier