Skip to content
Merged
13 changes: 13 additions & 0 deletions macros/developer-tools/environment-variables-priority.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
macro: environment-variables-priority
---

When the same environment variable is injected by multiple sources, the Scaleway infrastructure follows a precedence rule to determine the value for that variable.

The order of precedence, from highest to lowest is the following.

1. Environment variables defined in your command-line environment.

2. Static variables (i.e. variables set in a [Terraform/OpenTofu configuration file](/terraform/reference-content/scaleway-configuration-file/)).

3. Variables defined in the [Scaleway SDK configuration file](/scaleway-sdk/reference-content/scaleway-configuration-file/) or [Scaleway CLI configuration file](/scaleway-cli/reference-content/scaleway-configuration-file/).
36 changes: 11 additions & 25 deletions macros/developer-tools/scaleway-environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,16 @@
macro: scaleway-environment-variables
---

## Reserved environment variables

The following standardized Scaleway environment variables are used for the CLI and API.

| Variable | Description | Legacy variables |
| :----------------------------- | :----------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------ |
| `$SCW_ACCESS_KEY` | The [access key](/iam/how-to/create-api-keys/) of a token | `$SCALEWAY_ACCESS_KEY` (used by Terraform/OpenTofu) |
| `$SCW_SECRET_KEY` | The [secret key](/iam/how-to/create-api-keys/) of a token | `$SCW_TOKEN` (used by the CLI), `$SCALEWAY_TOKEN` (used by Terraform/OpenTofu), `$SCALEWAY_ACCESS_KEY` (used by Terraform/OpenTofu) | |
| `$SCW_DEFAULT_REGION` | Your default [region](https://www.scaleway.com/en/developers/api/#regions-and-zones) | `$SCW_REGION` (used by the CLI),`$SCALEWAY_REGION` (used by Terraform/OpenTofu) |
| `$SCW_DEFAULT_ZONE` | Your default [Availability Zone](https://www.scaleway.com/en/developers/api/#regions-and-zones) | `$SCW_ZONE` (used by the CLI),`$SCALEWAY_ZONE` (used by Terraform/OpenTofu) |
| `$SCW_API_URL` | URL of the API | - |
| `$SCW_INSECURE` | Set this variable to `true` to enable the [insecure mode](/iot-hub/concepts/#insecure-connection) | `$SCW_TLSVERIFY` (inverse flag used by the CLI) |
| `$SCW_PROFILE` | Set the configuration profile to use | - |
| `$SCW_PROJECT_ID` | Your [Project ID](https://console.scaleway.com/project/settings) | `$SCW_DEFAULT_PROJECT_ID` |
| `$SCW_ORGANIZATION_ID` | Your [Organization ID](https://console.scaleway.com/organization/settings) | `$SCW_DEFAULT_ORGANIZATION_ID`, `$SCW_ORGANIZATION` (used by the CLI),`$SCALEWAY_ORGANIZATION` (used by Terraform/OpenTofu) |

## Environment variables priority

When the same environment variable is injected by multiple sources, the Scaleway infrastructure follows a precedence rule to determine the value for that variable.

The order of precedence, from highest to lowest is the following.

1. Environment variables defined in your command-line environment.

2. Static variables (i.e. variables set in a Terraform/OpenTofu configuration file).

3. Variables defined in the [Scaleway configuration file](/scaleway-sdk/reference-content/scaleway-configuration-file/)
| Variable | Description | Legacy variables | |
| :--------------------- | :------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------- | --- |
| `$SCW_ACCESS_KEY` | The [access key](/iam/how-to/create-api-keys/) of a token | `$SCALEWAY_ACCESS_KEY` (used by Terraform/OpenTofu) | |
| `$SCW_SECRET_KEY` | The [secret key](/iam/how-to/create-api-keys/) of a token | `$SCW_TOKEN` (used by the CLI), `$SCALEWAY_TOKEN` (used by Terraform/OpenTofu), `$SCALEWAY_ACCESS_KEY` (used by Terraform/OpenTofu) | |
| `$SCW_DEFAULT_REGION` | Your default [region](https://www.scaleway.com/en/developers/api/#regions-and-zones) | `$SCW_REGION` (used by the CLI),`$SCALEWAY_REGION` (used by Terraform/OpenTofu) | |
| `$SCW_DEFAULT_ZONE` | Your default [Availability Zone](https://www.scaleway.com/en/developers/api/#regions-and-zones) | `$SCW_ZONE` (used by the CLI),`$SCALEWAY_ZONE` (used by Terraform/OpenTofu) | |
| `$SCW_API_URL` | URL of the API | - | |
| `$SCW_INSECURE` | Set this variable to `true` to enable the [insecure mode](/iot-hub/concepts/#insecure-connection) | `$SCW_TLSVERIFY` (inverse flag used by the CLI) | |
| `$SCW_PROFILE` | Set the configuration profile to use | - | |
| `$SCW_PROJECT_ID` | Your [Project ID](https://console.scaleway.com/project/settings) | `$SCW_DEFAULT_PROJECT_ID` | |
| `$SCW_ORGANIZATION_ID` | Your [Organization ID](https://console.scaleway.com/organization/settings) | `$SCW_DEFAULT_ORGANIZATION_ID`, `$SCW_ORGANIZATION` (used by the CLI),`$SCALEWAY_ORGANIZATION` (used by Terraform/OpenTofu) | |
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ dates:
posted: 2023-05-15
---
import ScalewayEnvironmentVariables from '@macros/developer-tools/scaleway-environment-variables.mdx'
import EnvironmentVariablesPriority from '@macros/developer-tools/environment-variables-priority.mdx'


## Reserved environment variables
<ScalewayEnvironmentVariables />

## Environment variables priority
<EnvironmentVariablesPriority />
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ dates:
posted: 2023-05-15
---
import ScalewayEnvironmentVariables from '@macros/developer-tools/scaleway-environment-variables.mdx'
import EnvironmentVariablesPriority from '@macros/developer-tools/environment-variables-priority.mdx'


## Reserved environment variables
<ScalewayEnvironmentVariables />

## Environment variables priority
<EnvironmentVariablesPriority />
4 changes: 4 additions & 0 deletions pages/serverless-jobs/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export const serverlessJobsMenu = {
label: 'Jobs limitations',
slug: 'jobs-limitations',
},
{
label: 'Injected environment variables',
slug: 'injected-environment-variables',
},
{
label: 'Differences between Jobs, Functions and Containers',
slug: 'difference-jobs-functions-containers',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Injected environment variables
description: This page contains a list of environment variables injected by default in the Job Runs.
tags: serverless jobs environment variables
dates:
validation: 2026-02-16
posted: 2026-02-16
---
import EnvironmentVariablesPriority from '@macros/developer-tools/environment-variables-priority.mdx'

The following standardized Scaleway environment variables are injected by default in the Job runs to improve and optimize data management.

| Variable name | Description | Sample value |
| :--------------------------- | :------------------------------------- | :------------------------------------- |
| `$SCW_SLS_RESOURCE_ID` | ID of the Job run | `00000000-0000-0000-0000-000000000000` |
| `$SCW_SLS_PARENT_ID` | ID of the Job definition | `00000000-0000-0000-0000-000000000000` |
| `$SCW_SLS_RESOURCE_NAME` | Name of the Job run | `"job-name"` |
| `$SCW_SLS_PROJECT_ID` | ID of the Project of the Job | `00000000-0000-0000-0000-000000000000` |
| `$SCW_SLS_ORGANIZATION_ID` | ID of the Organization of the Job | `00000000-0000-0000-0000-000000000000` |
| `$SCW_SLS_CPU` | vCPU limit of the Job run | `560` |
| `$SCW_SLS_RAM` | Memory limit of the Job run | `1024` |
| `$SCW_SLS_EPHEMERAL_STORAGE` | Ephemeral storage limit of the Job run | `1000` |
| `$SCW_SLS_IMAGE` | Image of the Job run | `scaleway/cli:latest` |
| `$SCW_SLS_REGION` | Region of the Job run | `fr-par` |

<Message type="note">
It is not possible to use any other environment variable key that starts with `SCW_SLS`, regardless of case. Refer to the [Jobs limitations](/serverless-jobs/reference-content/jobs-limitations/#environment-variables-restrictions) documentation page for more information.
</Message>

## Environment variables priority

<EnvironmentVariablesPriority />
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ dates:
posted: 2023-05-24
---
import ScalewayEnvironmentVariables from '@macros/developer-tools/scaleway-environment-variables.mdx'
import EnvironmentVariablesPriority from '@macros/developer-tools/environment-variables-priority.mdx'


## Reserved environment variables
<ScalewayEnvironmentVariables />

## Environment variables priority
<EnvironmentVariablesPriority />
Loading