@@ -109,11 +109,26 @@ resource "scaleway_k8s_pool" "john" {
109109 size = 1
110110}
111111
112+ ########################################################
113+ # Authentication method for an IAM user
114+ data "scaleway_iam_user" "george" {
115+ 116+ }
117+ resource "scaleway_iam_api_key" "ada" {
118+ user_id = data.scaleway_iam_user.george.id
119+ }
120+ # Authentication method for an IAM application
121+ resource "scaleway_iam_application" "albert" {}
122+ resource "scaleway_iam_api_key" "ada" {
123+ application_id = data.scaleway_iam_user.albert.id
124+ }
125+ ########################################################
126+
112127resource "null_resource" "kubeconfig" {
113128 depends_on = [scaleway_k8s_pool.john] # at least one pool here
114129 triggers = {
115130 host = scaleway_k8s_cluster.joy.kubeconfig[0].host
116- token = scaleway_k8s_cluster.joy.kubeconfig[0].token
131+ token = scaleway_iam_api_key.ada.secret_key
117132 cluster_ca_certificate = scaleway_k8s_cluster.joy.kubeconfig[0].cluster_ca_certificate
118133 }
119134}
@@ -150,11 +165,26 @@ resource "scaleway_k8s_pool" "john" {
150165 size = 1
151166}
152167
168+ ########################################################
169+ # Authentication method for an IAM user
170+ data "scaleway_iam_user" "george" {
171+ 172+ }
173+ resource "scaleway_iam_api_key" "ada" {
174+ user_id = data.scaleway_iam_user.george.id
175+ }
176+ # Authentication method for an IAM application
177+ resource "scaleway_iam_application" "albert" {}
178+ resource "scaleway_iam_api_key" "ada" {
179+ application_id = data.scaleway_iam_user.albert.id
180+ }
181+ ########################################################
182+
153183resource "null_resource" "kubeconfig" {
154184 depends_on = [scaleway_k8s_pool.john] # at least one pool here
155185 triggers = {
156186 host = scaleway_k8s_cluster.joy.kubeconfig[0].host
157- token = scaleway_k8s_cluster.joy.kubeconfig[0].token
187+ token = scaleway_iam_api_key.ada.secret_key
158188 cluster_ca_certificate = scaleway_k8s_cluster.joy.kubeconfig[0].cluster_ca_certificate
159189 }
160190}
@@ -350,6 +380,7 @@ resource "scaleway_k8s_cluster" "jack" {
350380 name = "jack"
351381 version = "1.18.0"
352382 cni = "cilium"
383+ delete_additional_resources = true
353384
354385 default_pool {
355386 node_type = "DEV1-M"
@@ -365,6 +396,7 @@ resource "scaleway_k8s_cluster" "jack" {
365396 name = "jack"
366397 version = "1.18.0"
367398 cni = "cilium"
399+ delete_additional_resources = true
368400}
369401
370402resource "scaleway_k8s_pool" "default" {
0 commit comments