Configuration as Code with IBM Cloud App Configuration

Josephinejustin
3 min readFeb 24, 2022

Configuration as Code (CAC) is a set of practices to manage application configuration using version control. This implies that the configurations are stored in git, or a similar version control system. Maintaining configurations in git gains the benefits of versioning, approval process and traceability.

IBM Cloud App Configuration is a centralized feature management and configuration service in IBM Public Cloud. App Configuration helps to deploy application configuration data, with git as a single source of truth.

Why Configuration as Code?

Configuration as Code bring many benefits.

· Standardization — Having configuration like source code, helps maintain the same development process for code and configuration. Development best practices like source code scanning, linting, approval process etc., can be followed for both code and configuration.

· Governance and Traceability — To elevate the release quality, traceability of changes deployed is a key. When a bug slips in, root cause of the code can be easily identifiable.

· Approval process — Maintaining configuration like source code in a version control system, helps achieve the approval process.

· Automation — Configuration is written as a code and can be tied into git operations. This helps in integrating feature delivery to pipelines, automated testing etc.,

IBM Cloud App Configuration and Configuration as Code

Feature flags when centrally managed by App Configuration provides the benefit of decoupling the deployment of code from a release. Specifically this comes in handy when the features to be released with minimal risk. Features can be toggled off when a major bug slips in. This gives the flexibility of maintaining the configuration as any other source code while getting the benefit of IBM Cloud App Configuration. IBM Cloud App Configuration can be used as a centralized configuration and also update the configuration without redeploying the entire application.

Application source code uses App Configuration SDK to evaluate the feature flag state and value. Application configuration details are also stored into git, and pull request approvals are used to approve the changes. When a configuration file changes are merged to git, App Configuration service instance can be automatically updated as part of the git approval process using git actions.

If the feature flags are toggled directly in the App Configuration service, when a major bug slips in, those can be exported into the configuration file and changes can be merged to git.

Sync config file changes to IBM Cloud App Configuration

When the configuration file is maintained in git, git actions can be used to sync the approved configuration back to the App Configuration instance. This is an automated process integrated into git, which can trigger the updates of configuration changes made to the git file to IBM Cloud App Configuration service.

Git action defines a workflow which can run multiple jobs. When a configuration file change is detected, IBM Cloud App Configuration Sync action can be trigged automatically. Creating IBM Cloud API Key and App Configuration instance id as a git secret is pre-requisite to run this action. Yaml file in /.github/workflows/ path of your repository defines the steps and parameters. A sample yaml file is available here. Details on the input parameters are available here.

Output of a sample run is like the below. This is automatically triggered when the configuration file change is approved as part of the pull request.

Configuration file in git is considered as the single source of truth and the configuration in App Configuration instance is over-written with the contents of the file.

Summary

IBM Cloud App Configuration provides the flexibility of maintaining the configuration as code and a centralized feature flag system. This helps in reducing the risk of feature releases along with the governance required in maintaining the configurations.

Resources

--

--