Skip to content

Commit 1c5c31a

Browse files
committed
Scaleway auth in entrypoint and explicit provider config
1 parent 46ed2d5 commit 1c5c31a

7 files changed

Lines changed: 77 additions & 11 deletions

File tree

.github/workflows/main.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
needs: [build-test-artifacts]
5555
strategy:
5656
matrix:
57-
starter: ["multi-cloud", "aks", "eks", "gke"]
57+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
5858

5959
permissions:
6060
id-token: write # required for keyless signing
@@ -117,7 +117,7 @@ jobs:
117117
strategy:
118118
fail-fast: false
119119
matrix:
120-
starter: ["multi-cloud", "aks", "eks", "gke"]
120+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
121121

122122
steps:
123123
- name: "Download test-artifacts"
@@ -208,9 +208,21 @@ jobs:
208208
# SCW: set region
209209
sed -i 's/# region = "fr-par"/region = "fr-par"/g' scw_zero_cluster.tf || true
210210
211+
# SCW: set cluster_version (scw quickstart has this commented out; multi-cloud has it active already)
212+
sed -i 's/# cluster_version = "1.35"/cluster_version = "1.35"/g' scw_zero_cluster.tf || true
213+
211214
# SCW: set zones
212215
sed -i 's/# zones = \["fr-par-1", "fr-par-2", "fr-par-3"\]/zones = ["fr-par-1", "fr-par-2", "fr-par-3"]/g' scw_zero_cluster.tf || true
213216
217+
# SCW: set organization_id
218+
sed -i 's/organization_id = ""/organization_id = "c3d17bc8-d7a3-48ac-b6e2-d8135e76ceb7"/g' scw_zero_providers.tf || true
219+
220+
# SCW: set project_id
221+
sed -i 's/project_id = ""/project_id = "b2bf9427-9ca5-4320-9fb3-ea9a33451338"/g' scw_zero_providers.tf || true
222+
223+
# SCW: set provider region
224+
sed -i 's/region = ""/region = "fr-par"/g' scw_zero_providers.tf || true
225+
214226
- name: "OpenTofu init"
215227
working-directory: ./kubestack-starter-${{ matrix.starter }}
216228
run: |
@@ -241,23 +253,25 @@ jobs:
241253
KBST_AUTH_AWS: ${{ secrets.KBST_AUTH_AWS }}
242254
KBST_AUTH_AZ: ${{ secrets.KBST_AUTH_AZ }}
243255
KBST_AUTH_GCLOUD: ${{ secrets.KBST_AUTH_GCLOUD }}
256+
KBST_AUTH_SCW: ${{ secrets.KBST_AUTH_SCW }}
244257
run: |
245258
docker run --rm \
246259
-e KBST_AUTH_AWS \
247260
-e KBST_AUTH_AZ \
248261
-e KBST_AUTH_GCLOUD \
262+
-e KBST_AUTH_SCW \
249263
-v `pwd`:/infra \
250264
-v /var/run/docker.sock:/var/run/docker.sock \
251265
test-image:${{ github.sha }} \
252-
tofu plan --target module.aks_zero --target module.eks_zero --target module.gke_zero
266+
tofu plan --target module.aks_zero --target module.eks_zero --target module.gke_zero --target module.scw_zero
253267
254268
publish-image:
255269
runs-on: ubuntu-latest
256270
needs: [test]
257271

258272
strategy:
259273
matrix:
260-
starter: ["multi-cloud", "aks", "eks", "gke"]
274+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
261275

262276
steps:
263277
- name: "Download test-artifacts"
@@ -304,7 +318,7 @@ jobs:
304318

305319
strategy:
306320
matrix:
307-
starter: ["multi-cloud", "aks", "eks", "gke"]
321+
starter: ["multi-cloud", "aks", "eks", "gke", "scw"]
308322

309323
steps:
310324
- name: "Download test-artifacts"

AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ Node-pool modules MUST additionally expose a configuration attribute for Kuberne
174174
- All configuration attribute names SHOULD mirror the respective provider resource attribute names.
175175
- Provider resource blocks containing nested arguments SHOULD be reflected as nested configuration object attributes.
176176

177+
#### Scaleway Provider Alias
178+
179+
Every `provider "scaleway"` alias block in a quickstart (one per Scaleway cluster) MUST explicitly set both `organization_id` and `project_id`.
180+
Unlike other supported providers, the Scaleway Terraform provider falls back to reading these values from the CLI config file or `SCW_DEFAULT_ORGANIZATION_ID` / `SCW_DEFAULT_PROJECT_ID` environment variables when they are absent from the provider block.
181+
Relying on that fallback means the target organization and project are determined by whatever auth context happens to be active at plan/apply time, rather than being captured in IaC.
182+
Setting them explicitly in the provider block makes the intended scope unambiguous and auditable.
183+
184+
Both values MUST be set as active empty-string assignments (`organization_id = ""`, `project_id = ""`) in the quickstart provider file, following the same pattern as `region = ""` for EKS and other providers that require values at the provider block level.
185+
The `region` attribute MUST also be set as an active empty-string assignment in the provider block so that it is visible and consistent with `organization_id` and `project_id`.
186+
Corresponding `sed` lines in the **"Configure Kubestack"** CI step MUST substitute the empty strings with real values before running `tofu validate` and `tofu plan`.
187+
177188
## Repository and Module Layout
178189

179190
### Directory Structure

oci/entrypoint_user

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,25 @@ if [ -x "$(command -v gcloud)" ]; then
5757
fi
5858
fi
5959

60+
#
61+
#
62+
# Scaleway auth
63+
# only if scw cli is installed
64+
if [ -x "$(command -v scw)" ]; then
65+
SCW_CONFIG_PATH=~/.config/scw
66+
mkdir -p $SCW_CONFIG_PATH
67+
68+
# handle base64 encoded SCW credentials
69+
if [ ! -z "$KBST_AUTH_SCW" ]; then
70+
echo "$KBST_AUTH_SCW" | base64 --decode > $SCW_CONFIG_PATH/config.yaml
71+
scw config validate
72+
fi
73+
fi
74+
6075
# do not have KBST_AUTH_* env vars set in runtime env
6176
unset KBST_AUTH_AWS
6277
unset KBST_AUTH_AZ
6378
unset KBST_AUTH_GCLOUD
79+
unset KBST_AUTH_SCW
6480

6581
exec "$@"

quickstart/src/configurations/multi-cloud/scw_zero_cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ module "scw_zero" {
3939
# Commercial node type — see `scw k8s node-pool list-available-types`
4040
node_type = "DEV1-M"
4141

42+
# Availability zones to distribute the default node pool across.
43+
# One pool is created per zone. Must be explicitly specified.
44+
# fr-par: zones = ["fr-par-1", "fr-par-2", "fr-par-3"]
45+
# nl-ams: zones = ["nl-ams-1", "nl-ams-2", "nl-ams-3"]
46+
# pl-waw: zones = ["pl-waw-1", "pl-waw-2", "pl-waw-3"]
47+
# zones = ["fr-par-1", "fr-par-2", "fr-par-3"]
48+
4249
# Initial number of nodes in the pool
4350
size = 1
4451

quickstart/src/configurations/multi-cloud/scw_zero_providers.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
provider "scaleway" {
2-
# region is read from SCW_DEFAULT_REGION environment variable
3-
# or can be set explicitly, e.g.:
4-
# region = "fr-par"
2+
# The Scaleway provider requires organization_id and project_id to be set
3+
# explicitly so the target scope is captured in IaC rather than inferred
4+
# from the CLI config or SCW_DEFAULT_ORGANIZATION_ID / SCW_DEFAULT_PROJECT_ID
5+
# environment variables.
6+
organization_id = ""
7+
project_id = ""
8+
9+
# Region is also required. Set it to match the region configured in the
10+
# cluster module, e.g. "fr-par", "nl-ams", "pl-waw".
11+
region = ""
512
}
613

714
provider "kustomization" {

quickstart/src/configurations/scw/scw_zero_cluster.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ module "scw_zero" {
2121
# Uncomment and set to your target region, e.g:
2222
# region = "fr-par"
2323

24+
# Kubernetes version for the cluster
25+
# Use a minor version string to allow patch upgrades, e.g. "1.32"
26+
# cluster_version = "1.32"
27+
2428
default_node_pool = {
2529
# Commercial node type — must be available in every zone listed below.
2630
# Run `scw k8s node-pool list-available-types` to list types per zone.

quickstart/src/configurations/scw/scw_zero_providers.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
provider "scaleway" {
2-
# region is read from SCW_DEFAULT_REGION environment variable
3-
# or can be set explicitly, e.g.:
4-
# region = "fr-par"
2+
# The Scaleway provider requires organization_id and project_id to be set
3+
# explicitly so the target scope is captured in IaC rather than inferred
4+
# from the CLI config or SCW_DEFAULT_ORGANIZATION_ID / SCW_DEFAULT_PROJECT_ID
5+
# environment variables.
6+
organization_id = ""
7+
project_id = ""
8+
9+
# Region is also required. Set it to match the region configured in the
10+
# cluster module, e.g. "fr-par", "nl-ams", "pl-waw".
11+
region = ""
512
}
613

714
provider "kustomization" {

0 commit comments

Comments
 (0)