variable project_id

This commit is contained in:
Valentin CZERYBA 2022-10-20 16:30:38 +02:00
parent 29a040751a
commit ad5dbdc914
2 changed files with 56 additions and 9 deletions

View File

@ -1,10 +1,13 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
35323139356565316333376432336436666566666631363635366235316435313536373765383234 33613465613332313264333531363966386165643866306463363039613666343736633366666439
6664623264396635643636663865626130616135326230610a373064656264323233663563623930 3962323963656131333937373932346536343861303936310a623331343034636330346438633232
38373762363331663632343036336139663833616638653361363535643239643166363435613764 62393434623539376136616265623937326235636638343932363235353337643135373866363362
3864363664303836380a363739653638623639663262356532656262393862323164656531393531 6237623238623536620a346463373363333965646132376330616166623065343961343166373563
35663166376632663734356666306433383363386236613330663536326432306561653665356533 36316531623062313136383231366161363261633762616661663435393430346536356635313133
64396538376432336532343366393938363963656432353638346165313836373136343433623435 35636136336333623262653636323864313164623265313138373434643936323864366363643161
65626138633637653631386663386462623633656434363761623366626565396362663864613166 36323836363330346430653232356163663837366636653438316265303763646263303838346637
33346136386532636132613532626133376534326339646161356461346434626335376661656534 30646533386663363430623736393637356536663962346266626262373839323166313235643232
32343936616335376563363131643938333833376231663862333961383566666137 37393838633437383635323163326564646634626238393264653133386262656239396462333563
31363137396535643161633435643064643064653037363261303932366163373131663261666361
62613264353730343261613631303436346438646231643165373535353630353238393838633462
37613633666139326364

View File

@ -0,0 +1,44 @@
terraform {
required_providers {
scaleway = {
source = "scaleway/scaleway"
}
}
required_version = ">= 0.13"
}
resource "scaleway_k8s_cluster" "{{ project_name }}" {
name = "{{ project_name }}"
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
)
}