Immutable configuration

I had the opportunity to review a new Juju charm hpcc. The charm passed the charm proof tests and deployed succesfully, but still did not pass the review because of immutable configuration.

Everyone may not be familiar with immutable configuration options or why this is bad so I wanted to blog about it and explain why. Hopefully future charm authors will read this and avoid the problem in the future.

In this case the configuration options are immutable if they can not be changed once set can not be changed after the charm is created. Not being able to change configuration is a bad thing. If a Juju user sets a configuration option they expect that the charm will take action to process that change right away. If that does not happen it breaks the user's expectation of configuration.

The way to avoid immutable configuration is to process all configuration changes in the charm when the values are set.

When the user sets a configuration value in Juju, that calls the config-changed hook. The charm should process all configuration options in the config-changed hook or trigger the processing from the config-changed hook.

That is all that is needed to avoid immutable configuration! Happy charming!