How to delete a particular variable from a configuration created by a custom module I have created a custom module and a configuration say 'abc_settings'. This configuration creates a variable for each vocabulary present on the site like vocab1_options, vocab2_options, vocab3_options etc.
I want to delete 'vocab1_options' when vocabulary 1 (vocab1) will be deleted. How to achieve this ?
Deleting a config key:

Updating per Berdirs comment, deleting/clearing a key within a config object, not deleting the entire config object:

Drupal::configFactory()-&gt;getEditable('abc_settings')-&gt;clear($entity-&gt;id() . '_options')-&gt;save();


Deleting config objects:

I did this within TVI module, anytime a term or vocab is deleted:

/**
 * Implements hook_ENTITY_TYPE_delete().
 * Remove TVI settings when vocabularies are deleted.
 * @param EntityInterface $entity
 */
function tvi_taxonomy_vocabulary_delete(EntityInterface $entity) {
  Drupal::configFactory()-&gt;getEditable('tvi.taxonomy_vocabulary.' . $entity-&gt;id())-&gt;delete();
}

/**
 * Implements hook_taxonomy_term_delete().
 * Remove TVI settings when terms are deleted.
 * @param EntityInterface $entity
 */
function tvi_taxonomy_term_delete(EntityInterface $entity) {
  Drupal::configFactory()-&gt;getEditable('tvi.taxonomy_term.' . $entity-&gt;id())-&gt;delete();
}


Of course, you would pass your own config name to getEditable(), and the hook names need to have your module name and not tvi.

This will delete any config matching that name when a term or vocab is deleted.

I haven't taken the step yet in my own code, but you could go further and implement a method that before a vocabularly entity is deleted, get all of its children, loop and delete config, then delete the vocab and its config.

Example:

Drupal::configFactory()-&gt;getEditable($entity-&gt;id() . '_options')-&gt;delete();