Skip to content

Commit 1082886

Browse files
committed
feat(ske): add datasource to query provider options
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
1 parent 4552b14 commit 1082886

File tree

7 files changed

+896
-0
lines changed

7 files changed

+896
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stackit_ske_provider_options Data Source - stackit"
4+
subcategory: ""
5+
description: |-
6+
Returns a list of supported Kubernetes versions and a list of supported machine types for the cluster nodes.
7+
---
8+
9+
# stackit_ske_provider_options (Data Source)
10+
11+
Returns a list of supported Kubernetes versions and a list of supported machine types for the cluster nodes.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "stackit_ske_provider_options" "default" {}
17+
18+
data "stackit_ske_provider_options" "eu02" {
19+
region = "eu02"
20+
}
21+
22+
locals {
23+
k8s_versions = [
24+
for v in data.stackit_ske_provider_options.default.kubernetes_versions :
25+
v.version if v.state == "supported"
26+
]
27+
first_k8s_version = length(local.k8s_versions) > 0 ? local.k8s_versions[0] : ""
28+
last_k8s_version = length(local.k8s_versions) > 0 ? local.k8s_versions[length(local.k8s_versions) - 1] : ""
29+
30+
31+
flatcar_supported_versions = flatten([
32+
for mi in data.stackit_ske_provider_options.default.machine_images : [
33+
for v in mi.versions :
34+
v.version if mi.name == "flatcar" && v.state == "supported"
35+
]
36+
])
37+
38+
ubuntu_supported_versions = flatten([
39+
for mi in data.stackit_ske_provider_options.default.machine_images : [
40+
for v in mi.versions :
41+
v.version if mi.name == "ubuntu" && v.state == "supported"
42+
]
43+
])
44+
}
45+
```
46+
47+
<!-- schema generated by tfplugindocs -->
48+
## Schema
49+
50+
### Optional
51+
52+
- `region` (String) Region override. If omitted, the provider’s region will be used.
53+
54+
### Read-Only
55+
56+
- `availability_zones` (List of String) List of availability zones in the selected region.
57+
- `kubernetes_versions` (Attributes List) Supported Kubernetes versions. (see [below for nested schema](#nestedatt--kubernetes_versions))
58+
- `machine_images` (Attributes List) Supported machine image types and software versions. (see [below for nested schema](#nestedatt--machine_images))
59+
- `machine_types` (Attributes List) List of machine types (node sizes) available in the region. (see [below for nested schema](#nestedatt--machine_types))
60+
- `volume_types` (List of String) Supported root volume types (e.g., `storage_premium_perf1`).
61+
62+
<a id="nestedatt--kubernetes_versions"></a>
63+
### Nested Schema for `kubernetes_versions`
64+
65+
Read-Only:
66+
67+
- `expiration_date` (String) Expiration date of the version in RFC3339 format.
68+
- `state` (String) Version state, such as `supported`, `preview`, or `deprecated`.
69+
- `version` (String) Kubernetes version string (e.g., `1.27`).
70+
71+
72+
<a id="nestedatt--machine_images"></a>
73+
### Nested Schema for `machine_images`
74+
75+
Read-Only:
76+
77+
- `name` (String) Name of the OS image (e.g., `ubuntu`).
78+
- `versions` (Attributes List) Supported versions of the image. (see [below for nested schema](#nestedatt--machine_images--versions))
79+
80+
<a id="nestedatt--machine_images--versions"></a>
81+
### Nested Schema for `machine_images.versions`
82+
83+
Read-Only:
84+
85+
- `cri` (List of String) Container runtimes supported (e.g., `containerd`).
86+
- `expiration_date` (String) Expiration date of the version in RFC3339 format.
87+
- `state` (String) State of the image version (e.g., `supported`, `preview`, `deprecated`).
88+
- `version` (String) Machine image version string.
89+
90+
91+
92+
<a id="nestedatt--machine_types"></a>
93+
### Nested Schema for `machine_types`
94+
95+
Read-Only:
96+
97+
- `architecture` (String) CPU architecture (e.g., `x86_64`, `arm64`).
98+
- `cpu` (Number) Number of virtual CPUs.
99+
- `gpu` (Number) Number of GPUs included.
100+
- `memory` (Number) Memory size in GB.
101+
- `name` (String) Machine type name (e.g., `c2i.2`).
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
data "stackit_ske_provider_options" "default" {}
2+
3+
data "stackit_ske_provider_options" "eu02" {
4+
region = "eu02"
5+
}
6+
7+
locals {
8+
k8s_versions = [
9+
for v in data.stackit_ske_provider_options.default.kubernetes_versions :
10+
v.version if v.state == "supported"
11+
]
12+
first_k8s_version = length(local.k8s_versions) > 0 ? local.k8s_versions[0] : ""
13+
last_k8s_version = length(local.k8s_versions) > 0 ? local.k8s_versions[length(local.k8s_versions) - 1] : ""
14+
15+
16+
flatcar_supported_versions = flatten([
17+
for mi in data.stackit_ske_provider_options.default.machine_images : [
18+
for v in mi.versions :
19+
v.version if mi.name == "flatcar" && v.state == "supported"
20+
]
21+
])
22+
23+
ubuntu_supported_versions = flatten([
24+
for mi in data.stackit_ske_provider_options.default.machine_images : [
25+
for v in mi.versions :
26+
v.version if mi.name == "ubuntu" && v.state == "supported"
27+
]
28+
])
29+
}

0 commit comments

Comments
 (0)