A Drupal configuration import can enable a module, add a field—or remove configuration that is absent from the files being imported. That last part is easy to overlook when a deployment is treated as “copy these settings over.” Configuration management is designed to synchronize a site’s configuration, not merge arbitrary environments without consequences.
This walkthrough is for Drupal site builders moving changes from development through staging to production. It focuses on a decision point: how to review the exported configuration and the target site’s import changes before applying them. Commands below use Drush’s standard config:export and config:import workflow; check the commands supported by your installed Drush and Drupal versions.
Summary
- Drupal’s active configuration is stored in the database; exported YAML files provide a version-controlled deployment set.
- Export from the source environment, review the files, then inspect the target’s import differences before applying them.
- Imports can add, update and delete configuration, so check destructive changes and dependencies first.
- Keep environment-specific settings out of shared configuration where appropriate, and test the same deployment on staging.
What Drupal configuration includes
Configuration covers site settings such as content types, fields, views, enabled extensions and other site-building choices. It is distinct from content such as nodes and uploaded media. The active configuration normally lives in the database; the sync directory holds the exported files used to deploy a configuration set between copies of the same site.
That is why a configuration change is more than a YAML file edit. If you add a module, its configuration may depend on another module. If you remove a view or field from the exported set, the target import may remove it. Drupal also checks the site UUID so that a configuration set is not casually imported into an unrelated site.
A careful development-to-production workflow
-
Start from the correct code and environment. Confirm the site’s Drupal version, active configuration sync directory and Drush version. Make changes on development, not directly on production, and ensure the deployed code contains any modules or themes required by the configuration.
-
Export the source configuration. From the project root, a common Drush command is:
drush config:exportReview the changed YAML files in version control. If the export reports unexpected broad changes, stop and understand why before committing them.
-
Review the diff as a site change. Look for enabled or removed modules, field storage and field instance changes, display settings, permissions, views and settings that should not vary between environments. A deleted YAML file can represent a deliberate removal, but it can also signal that someone exported from the wrong database.
-
Deploy code and configuration together. A config import that references a module absent from the target codebase is not a complete deployment. Deploy Composer-managed code and database updates according to the project’s release procedure before importing configuration that depends on them.
-
Preview the target import. On staging, run:
drush config:import --preview=diffIf the installed Drush version does not support that preview option, use its documented configuration status/diff command or Drupal’s Configuration Synchronization UI. Read the proposed additions, updates and deletions rather than assuming “no errors” means “safe.”
-
Back up and import on staging. Take the site’s normal database backup, apply the import, and test the affected pages and administrative workflows. Confirm field data is still present and rendered as intended.
-
Repeat the reviewed release on production. Deploy the same tested code and configuration commit. Take a production backup, inspect the import plan against production’s active configuration and apply only when the proposed changes match the release you approved.
Do not export production back over development midway through a deployment without understanding how that changes the source of truth. Teams should establish which environment owns each configuration change and how urgent production fixes are brought back into version control.
What to inspect in an import preview
An import preview is a change review, not a risk score. Pay particular attention to deletions, because removing a configuration entity can affect content structure or site behavior. Check that:
- Every newly enabled module exists in the deployed code and its dependencies are available.
- New fields have compatible storage and display settings, especially on content types with existing data.
- Removed fields or views are intentionally removed and any dependent blocks, displays or code have been updated.
- Roles and permissions still match the organization’s access model.
- Environment-specific values such as local development tools or endpoints are not accidentally applied to production.
- The target site is the intended copy and has the expected UUID and configuration state.
A review cannot predict every runtime effect. A field may import cleanly while custom code assumes another field is present. Follow up with the site’s functional checks and logs.
When environment settings need a different approach
If development-only modules or settings should not travel to production, do not rely on remembering to delete their YAML files by hand before each deployment. The contributed Configuration Split project exists to separate selected configuration for different environments, but it adds configuration and process that must itself be tested and maintained. Use it when the team has a clear environment-specific configuration need; avoid adding it to a simple project that can keep environments aligned without it.
Configuration overrides are another mechanism for values that differ by environment, but they do not replace deployment review. Document which values are overridden and make sure secrets remain in protected environment configuration rather than committed YAML.
Mistakes that cause avoidable incidents
- Treating config import like a merge that only adds settings.
- Committing every exported file without examining the diff.
- Importing config before deploying modules and code it depends on.
- Testing on staging but applying a different, unreviewed configuration set to production.
- Using Configuration Split without understanding which split is active for export and import.
This is the same release discipline that helps with choosing Drupal update hooks: keep the change source clear and test the deployment path.
For environment-specific differences, consider whether a maintained split is necessary; this Drupal Configuration Split overview covers the trade-off.
My Take
The most valuable habit is to read the target import plan as if it were a code review. “It is just configuration” is not reassuring when configuration defines fields, permissions and routes that real users rely on.
Conclusion
Drupal configuration management is reliable when a team treats exports as versioned release artifacts and imports as changes that deserve review. Export on the source site, inspect the diff, preview on the target, test on staging and repeat the same reviewed change in production with a backup available.