Skip to content

Commit 64358a6

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

5 files changed

Lines changed: 40 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,17 @@ jobs:
206206
sed -i 's/# max_node_count = 3/max_node_count = 3/g' gke_zero_cluster.tf || true
207207
208208
# SCW: set region
209-
sed -i 's/# region = "fr-par"/region = "fr-par"/g' scw_zero_cluster.tf || true
209+
sed -i 's/region = ""/region = "fr-par"/g' scw_zero_cluster.tf || true
210210
211211
# SCW: set zones
212212
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
213213
214+
# SCW: set organization_id
215+
sed -i 's/organization_id = ""/organization_id = "c3d17bc8-d7a3-48ac-b6e2-d8135e76ceb7"/g' scw_zero_providers.tf || true
216+
217+
# SCW: set project_id
218+
sed -i 's/project_id = ""/project_id = "b2bf9427-9ca5-4320-9fb3-ea9a33451338"/g' scw_zero_providers.tf || true
219+
214220
- name: "OpenTofu init"
215221
working-directory: ./kubestack-starter-${{ matrix.starter }}
216222
run: |
@@ -241,11 +247,13 @@ jobs:
241247
KBST_AUTH_AWS: ${{ secrets.KBST_AUTH_AWS }}
242248
KBST_AUTH_AZ: ${{ secrets.KBST_AUTH_AZ }}
243249
KBST_AUTH_GCLOUD: ${{ secrets.KBST_AUTH_GCLOUD }}
250+
KBST_AUTH_SCW: ${{ secrets.KBST_AUTH_SCW }}
244251
run: |
245252
docker run --rm \
246253
-e KBST_AUTH_AWS \
247254
-e KBST_AUTH_AZ \
248255
-e KBST_AUTH_GCLOUD \
256+
-e KBST_AUTH_SCW \
249257
-v `pwd`:/infra \
250258
-v /var/run/docker.sock:/var/run/docker.sock \
251259
test-image:${{ github.sha }} \

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ 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 represented as commented-out example lines in the quickstart provider file (see Quickstart Placeholder and CI Injection Pattern), and activated by corresponding `sed` lines in the **"Configure Kubestack"** CI step.
185+
177186
## Repository and Module Layout
178187

179188
### 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_providers.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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+
region = ""
3+
organization_id = ""
4+
project_id = ""
55
}
66

77
provider "kustomization" {

quickstart/src/configurations/scw/scw_zero_providers.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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+
region = ""
3+
organization_id = ""
4+
project_id = ""
55
}
66

77
provider "kustomization" {

0 commit comments

Comments
 (0)