One variable that several apps use: an API key, an S3 bucket name, a SENTRY_DSN. Change it once
and every app that uses it gets the new value on its next deploy.
Two separate parts: who it is offered to, and which apps link it. Only the per-app link injects the variable. Until an app links it, the value reaches nothing.
Who it is offered to
The Shared with step has three scopes:
| Scope | Offered to |
|---|---|
| Teams | Every app in each team you tick |
| Projects | Every app in the chosen projects, or only in the environments you pick |
| Specific apps | Exactly the apps you pick. The only scope that links right away |
- Two variables can share a name if they are offered to different apps, for example one
DATABASE_URLper project. - A linked shared variable wins over the app's own variable with the same name, and loses to a preview override. If an app needs its own value, unlink the shared one.
Shared with two teams or more
Ticking a second team, for a company proxy or a registry mirror, changes the behaviour. The Review step says which kind you are creating.
- It is added automatically to every app in every ticked team. No link needed.
- It has the lowest priority, so an app's own value still wins.
- It shows on each app's Environment tab, read-only, with the owner team's name.
- You can only tick a team where you hold Manage environment variables on the whole team.
- Unticking teams until one is left turns the automatic add off. Deleting a team does not.
- An older instance-wide variable works the same way for every team, new ones included. It reads Every team, only an instance admin can change it, and no new one can be created.
A variable another team shares with you
It shows on your Shared tab with the owner team's name and no edit buttons. You can link it to your apps, not change it. If the owner stops sharing it with your team, your links are removed.
Create one
From the Variables page
Fill the rows
A name and a value per row. Add another adds rows, and a .env pasted into a name field splits
into rows. Secret applies to every row.
Set availability
Pick one or more scopes, then the teams, projects or apps. Review shows what will be created and how many apps it reaches.
From an app
On the app's Environment tab, click Add, open the Shared tab, then New shared variable. Same steps, and the variable is linked to this app as soon as it is created.
Creating, changing or deleting one needs Manage environment variables on the whole team. Without it the button is not shown.
Use one in an app
On the app's Environment tab, click Add, open the Shared tab and add the variable. Then redeploy.
- Manage, on a linked row, opens the variable on Variables -> Shared. Delete it there: it leaves every app it reaches on their next deploy.
- Remove from this app removes only this link. A variable shared with two or more teams keeps arriving, at the lowest priority.
Good to know
- The variable belongs to the team that created it. Deleting that team deletes the variable everywhere.
- A secret's name and value never change. You can still change who it is shared with.
- The compose file wins. A key it sets keeps the compose value; the row reads Set in the compose file.
- If everything it was offered to is deleted, the variable stays and reads Not shared with anything until you share it again.
Troubleshooting
| Symptom | What to check |
|---|---|
| The app does not see the value | It is offered but not linked. Link it on the app's Environment tab. |
| The value changed and the app still has the old one | It applies on the next deploy. Redeploy. |
| A different value than expected | A preview override or the compose file sets that key. For a variable added automatically, the app's own value wins. |
More in Deploys and builds.
Next steps
Did this page help you?
