2022-10-20 16:51:12 +02:00
|
|
|
terraform {
|
|
|
|
required_providers {
|
|
|
|
scaleway = {
|
|
|
|
source = "scaleway/scaleway"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
required_version = ">= 0.13"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-03 21:49:56 +01:00
|
|
|
resource "scaleway_k8s_cluster" "{{ project_name_tf }}" {
|
|
|
|
name = "{{ project_name_tf }}"
|
2022-10-20 16:51:12 +02:00
|
|
|
version = "1.24.3"
|
|
|
|
cni = "cilium"
|
|
|
|
project_id = "{{ project_id }}"
|
|
|
|
region = "{{ region_k8s }}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "scaleway_k8s_pool" "john" {
|
|
|
|
cluster_id = scaleway_k8s_cluster.{{ project_name }}.id
|
|
|
|
name = "john"
|
|
|
|
node_type = "DEV1-M"
|
|
|
|
size = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "null_resource" "kubeconfig" {
|
|
|
|
depends_on = [scaleway_k8s_pool.john] # at least one pool here
|
|
|
|
triggers = {
|
|
|
|
host = scaleway_k8s_cluster.{{ project_name }}.kubeconfig[0].host
|
|
|
|
token = scaleway_k8s_cluster.{{ project_name }}.kubeconfig[0].token
|
|
|
|
cluster_ca_certificate = scaleway_k8s_cluster.{{ project_name }}.kubeconfig[0].cluster_ca_certificate
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
provider "kubernetes" {
|
|
|
|
load_config_file = "false"
|
|
|
|
|
|
|
|
host = null_resource.kubeconfig.triggers.host
|
|
|
|
token = null_resource.kubeconfig.triggers.token
|
|
|
|
cluster_ca_certificate = base64decode(
|
|
|
|
null_resource.kubeconfig.triggers.cluster_ca_certificate
|
|
|
|
)
|
|
|
|
}
|