Configuration split: deploy subsets of configuration in Drupal 8

From the Configuration split project page: "The Drupal 8 configuration management works best when importing and exporting the whole set of the sites configuration. However, sometimes developers like to opt out of the robustness of CMI and have a super-set of configuration active on their development machine and deploy only a subset. The canonical example for this is to have the devel module installed or having a few block placements or views in the development environment and then not export them into the set of configuration to be deployed, yet still being able to share the development configuration with colleagues."

This small utility module for Drupal 8 allows you to exactly achieve this use case (and many others). I will cover two common scenarios, explaining how to configure your site and which commands you need to run:

  1. Have (development/ui) modules installed on your dev environment, uninstalled on production
  2. Have modules installed on your production environment, but not on development

Configuration split 101

Configuration split exposes a configuration entity which controls what you want to split off. Currently you can

  • blacklist modules: any configuration that this module owns will automatically be blacklisted too.
  • blacklist configuration: settings or configuration entities. These will be removed from the active sync directory.
  • graylist configuration: settings or configuration entities. These will not be removed if they are in the active sync directory, but also not exported if they are not there yet. I won't cover this functionality in this article post, that will be for another time.

After you configured one or more configurations split entities, you can use the drush commands to export and import configuration, based on one or more of those config entities. When it comes to exporting configuration, you can not use the existing drush core command (config-export / cex). Using drush config-import (cim) or the UI to import may still be used, but this depends on your setup. Drupal Console commands are under revision. Important: since feb 2017, due to and, you can use the standard drush commands without any problems!

Each config split entity defines the directory in which the splitted configuration will live in case there are some. Not all modules define configuration, so there's a possibility that this directory is empty after you do an export.

An important technical aspect is that the module does not interfere with the active configuration but instead filters on the import/export pipeline. What simple happens is this: just before the actual writing, it will check the configuration and remove any entries that you don't want to be there. Then your active configuration is written away. Config that doesn't belong into the active configuration will be moved to separate directory. On import, the opposite happens: it will merge settings back in and set modules to the installed state just before core configuration then starts importing.

Last, but not least: you can swap the service so that the synchronize screen will use the config split config entities for importing. More information is in the README file and in the video.

Scenario 1: modules installed on dev, not on production

Step 1

After you installed the module, go to 'admin/config/development/configuration/config-split' and click on 'Add configuration split'. Naming is important, so we'll enter 'Dev split' as the name for this configuration. We'll also create a directory called 'sync-dev-split'. Now toggle the modules that you don't want to have installed on production. In this case, we're going to blacklist Devel, Devel Kint, Field UI, Views UI and database logging. Additionally, also toggle This configuration is owned by the system module, so there's no dependency on the devel module. There's no problem having this config on your production site though, so it's not required to blacklist it.

Optionally, you can also blacklist the configuration split module because it doesn't necessarily have to be installed on production. We're not doing that here, because in the second scenario, we're building further on this one and we want to have it installed on the production environment as well.

Step 2

Go to your command line interface and run following command:

swentel@dev:/home/drupal/drupal-core$ drush csex --split=dev_split

The split option is not required, but when starting to work with the module, it helps you to know which config split will be used for this command. It's possible to override the status of any config split config entity so that eventually, you can omit the split option. Sadly enough, you don't get any feedback (yet), but after the command has run you should see various files in your sync-dev-split directory:

swentel@dev:/home/drupal/drupal-core$ ls sync-dev-split/
dblog.settings.yml  devel.settings.yml  field_ui.settings.yml

Step 3

You can now commit your active sync and go to production. You don't necessarily have to put the sync-dev-live directory in your version control because production doesn't need to know about these files at all. Once you have pulled on production, go to the synchronize screen to verify what is staged. You will see that the setting files will be removed and core.extension will be changed uninstalling the development modules and installing configuration split. Since we only have one config split configuration, you can hit 'Import all' here or run drush config-import, (which is the drush core command). Note that if you don't use the UI, you can blacklist the configuration manager module as well.

You might wonder why we don't use the 'config-split-import' command from the module itself: this would import the active sync directory and also include the modules and settings again that we have blacklisted. And that's not what we want. This seems confusing at first, but ultimately, if this is your setup, you just keep on using the core / drush commands to import your staged configuration on production.

# This command can be used now, but not anymore further on when we will add scenario 2.
swentel@live:/home/drupal/drupal-core$ drush cim

Scenario 2: modules installed on production, not on dev

Step 1

This scenario builds further on the first one. Config split is now installed on our live website. Create a new config split configuration called 'Live split'. You will need a new directory for this second config split, so make sure it's there. On production we still want to log events and for that we're going to use the syslog module. Install the module, so that we can now blacklist it for the live split configuration.

Step 2

Go to your command line interface and run following commands:

swentel@live:/home/drupal/drupal-core$ drush csex --split=live_split

Again, no feedback here, but after the command has run you should see the syslog settings file in your sync-live-split directory:

swentel@live:/home/drupal/drupal-core$ ls sync-live-split/

Doing exports and imports on dev or live

From now on, if you want to import new settings whether it's on your dev or live environment, you can not use the drush core commands anymore. Use following commands:

# to export on your dev environment
swentel@dev:/home/drupal/drupal-core$ drush csex --split=dev_split
# to import on your dev environment
swentel@dev:/home/drupal/drupal-core$ drush csim --split=dev_split

# to export on your live environment
swentel@live:/home/drupal/drupal-core$ drush csex --split=live_split
# to import on your live environment
swentel@live:/home/drupal/drupal-core$ drush csim --split=live_split

The future

Please join us in the issue queue because there's still some work:

  • Optimize the user interface and allow wildcards
  • Add confirmation and feedback in the drush commands

Ultimately, this functionality should live in core. A core issue to discuss this is at


swentel on Mon, 28/11/2016 - 15:05

Yes, I'm aware of it. I couldn't get my use case of two way splits working which is a trivial task with config split. And by swapping the service the synchronize screen on both my environments know what's blacklisted/ignored.

Frederick on Tue, 14/02/2017 - 15:42

Instead of having to remember which environment you should be importing or exporting on the command line with --spilt= should be possible in your Drush site aliases file to set a command-specific array with the settings for --split= you want for each site alias.

$aliases['dev'] = array(
'path-aliases' => array(
'%files' => 'sites/default/files',
'command-specific' => array(
'config-split-export' => array(
'split' => 'dev_split',
'config-split-import' => array(
'split' => 'dev_split',
$aliases['live'] = array(',
'path-aliases' => array(
'%files' => 'sites/default/files',
'command-specific' => array(
'config-split-export' => array(
'split' => 'live_split',
'config-split-import' => array(
'split' => 'live_split',

Sorry, but the formating is killing the indentation on the code.

swentel on Wed, 15/02/2017 - 10:12

Currently I'm doing this in settings.php by enabling/disabling the config splits that I want . . it's a different technique but works as well.
I agree though a global drush setting probably is even better.

Frederick on Mon, 20/03/2017 - 08:44

I am guessing since you are doing it this way that the drush commands do not look for the settings.php configuration. The configuration sounds a bit disjoint at this point. The Config Split UI has its configuration in settings.php and drush either on the command line or in a drush config file.

Frederick on Fri, 16/06/2017 - 10:04

has been implemented. So you can do something like this in your dev.settings.php (If you have separate settings.php files for your environments.)

// Import and export the development environment configuration split, but not the test or live.
$config['config_split.config_split.dev_split']['status'] = TRUE;
$config['config_split.config_split.live_split']['status'] = FALSE;
$config['config_split.config_split.test_split']['status'] = FALSE;

Jo on Wed, 17/05/2017 - 21:32


Thus use case is not treated in the vid.

I guess we can do the same for a multi-site set-up which shares most configuration except for site settings, theme settings,... What would the worklfow be?

Atul-Kam on Fri, 16/06/2017 - 00:35


Is it possible to automatically add module to 'Dev Split' when I install it on Dev environment? So, that it wil exclude from the global configuration.

Frederick on Fri, 16/06/2017 - 10:07

How would the Config Split module know if it was not one you wanted to add to the live site too?

Atul-Kam on Thu, 29/06/2017 - 01:33

Thank you Frederick for your reply.
Maybe my scenario is different. I have multiple sites with the different set of modules enabled but the code base is same for all. So, in this case, if I install any module in local or dev environment then it will be part of global sync directory and it will be installed on all sites automatically unless I go to split settings page and add to 'Dev split' manually. So, there is a risk to get installed any new module on all sites if any developer miss to add it in Dev split (or any split).

soumyajit on Wed, 29/09/2021 - 14:09

I have configured drupal multisite. Can I use this?
In your example you are using same code for prod /dev just chang the db.

But in our case we have 2 sites folder. Could you please help me how we can configure it?

Add reply

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Have you written a response to this? Let me know the URL by sending a webmention.