Change record status: 
Project: 
Introduced in branch: 
8.8.x
Introduced in version: 
8.8.0-ALPHA1
Description: 

Introduction

Some modules help with developing a drupal site but are not intended to be deployed to production.
Up to Drupal 8.8.0 developers had to rely on contrib solutions such as Config Split to separate the development configuration. But sometimes it is not necessary to share the development configuration and instead it is more important to guarantee that development modules can not be included in the configuration export. This is precisely what the lesser known Config Exclude contrib module did and its functionality is now available to everyone.

How to use the new feature

in settings.php

$settings['config_exclude_modules'] = ['devel', 'stage_file_proxy'];

You need to use the drupal UI or drush 10+ for this to work.

Effects

Excluded modules and all the configuration that directly and indirectly depends on them are not exported through in the tarball and through tools using the config.storage.export service to export the configuration.
When importing the configuration, the excluded modules and their configuration are not removed.
It is possible to exclude required modules, which means that the exported configuration can not be imported any more.
This is an advanced feature and using it means opting out of some of the guarantees the configuration synchronisation provides.

Impacts: 
Site builders, administrators, editors
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

erlendoos’s picture

As also posted at https://drupal.stackexchange.com/questions/291639/how-to-prevent-modules...

I implemented this setting, but the configuration is still exported. How does this feature work?

I use drupal 8.8.2

erlendoos’s picture

This feature works if you make a fresh drupal 8.8 installation. When you upgrade from 8.7 this setting has no effect :-(

ressa’s picture

It looks like it requires Drush 10, whereas Drush 9 doesn't seem to work:
drush config:status does not respect excluded modules

mpp’s picture

Does this mean that devel and stage_file_proxy should still be enabled manually?
If so I don't see the advantage of this over config_exclude.

Would it make sense to have a list of "production" modules and another list of "dev" modules in core.extensions (like it is in composer)?
That said, devel and stage_file_proxy are two very different types of modules:
- devel is for development only
- stage_file_proxy is for QA (to mimic production files without the need to copy them over), and could also be used locally

ressa’s picture

It's a one-liner in my development script, after importing config, so for me it's not a big deal. I prefer this simple approach to adding an extra module, configuring it, etc. This approach of course doesn't allow tweaking the configuration. Also, you might not always want either development modules enabled by default, but only occasionally and manually, in which case it's nice to not have to disable before drush config:export, since they are excluded.

The last commands in my .lando.yml file:

[...]
- echo "# import configuration"
- drush config:import --diff -v -y
- echo "# enable Views UI, Devel and WebProfiler"
- drush en views_ui devel webprofiler -y
- drush cache:rebuild
- echo "### one time login for admin"
- drush uli
John Pitcairn’s picture

If you are excluding a module that provides permissions, then any user roles with those permissions enabled will be deleted on export.

As of 9.3.0, user roles have a dependency on the module providing each permission. If the permission is enabled but the module isn't present in the core.extension config (because its config is excluded), the dependency is considered "missing" and the user role config will be deleted.

If you start seeing user roles being deleted on config export after upgrading to 9.3, this is why.

ressa’s picture

Thanks for sharing that info @John Pitcairn, that is great to know. It might even be added in the Issue Summary, since it can have pretty big consequences, and take quite some time to debug?

mfv’s picture

We are seeing this issue as well with a config exclude on the google tag module. This will ignore all user roles that are related to the google tag module.

I created an issue here: https://www.drupal.org/project/drupal/issues/3262290