﻿# Variable sets

Octopus [variables](/docs/projects/variables/) can be added to variables sets, which make it possible to define variables for use with multiple [projects](/docs/projects).

This can be useful if you have the same variables that are used across multiple projects. Instead of defining the variables for each project, you can define a set of variables in the Variable Set and then access them from every project that needs them.

## Creating a variable set

1. Navigate to **Deploy ➜ Variable Sets** and click **Add Variable Set**.
2. Give the variable set a name, a description, and click **Save**.
3. Define the variables. As with project variables, variable sets can be [scoped](/docs/projects/variables/getting-started/#scoping-variables) to environment, deployment target, or target tags.
4. Save the variable set by clicking **Save**.

## Adding the variable set to a project

1. Navigate to your project
2. Click **Variable Sets**.
3. Click **Include Variable Sets**.
4. Search for the Variable Set you'd like to include, click the check-box and **Save**.

## Viewing the variable set

If you want to review the Variable Set you've created, from a project you can navigate to **Variable Set**.

If you want to review the Project variables and the Variable Set, from a project you can navigate to **All Variables**.

## Rename a variable set

1. Navigate to **Deploy ➜ Variable Sets**.
2. Select the variable set.
3. Click settings, and expand the **Name** section.
4. Enter the new name and click **Save**.

## View the variable set audit trail

Viewing the audit trail for a Variable Set will show you what changes have been made to the variable, when the changes were made, and which user made the changes.  

1. Navigate to **Deploy ➜ Variable Sets**.
2. Select the variable set. Click the ... overflow menu and select **Audit Trail**.
3. Click on an event to see what changed

To filter the audit trail by **date**, click the date range. Select a predefined date range or enter a custom date range.

You can use the following advanced filters to refine the result of the audit trail:

- Event groups.
- Event categories.
- Document types.
- Users.
- Projects.
- Environments.

## Naming variable set variables

Always try to name variables in a variable set uniquely to avoid variable name collision. A common example is when a project and a variable set have the same variable name, scoped to the same environment. When a name collision occurs, Octopus Deploy will do its best to pick the *right one* [using an algorithm](/docs/projects/variables/getting-started/#scope-specificity). But sometimes the variables are scoped equally. If this occurs, Octopus will choose project-defined variables ahead of library-defined ones.

Read more about our recommendations for [variable naming](/docs/getting-started/best-practices/variables/#variable-naming).

## Learn more

- [Variable blog posts](https://octopus.com/blog/tag/variables/1)
