Last updated Sep 6, 2021

Rate this page:

What is configuration as code?

What is configuration as code?

Configuration as code (config-as-code) is an automated method of maintaining Compass component data in a Git repository. You can choose to declare component details in a YAML file that sits alongside the source code for the component itself. Learn more about how config-as-code works

Why should I sync a component?

With config-as-code, you can take an existing Compass component and move its source of truth to a YAML configuration file in your code repository. Once you connect the component with your repository, update the component's data by updating the YAML configuration file. Any updates to the YAML file on your repository’s default branch automatically sync back to Compass and reflect in Compass.

In this way, you can use the same version control practices for maintaining component data as you use for the rest of your codebase.

What tools can I use to manage synced components?

Compass currently supports config-as-code with Bitbucket Cloud.

How does config as code work?

Here’s how config-as-code works:

  • To set up config-as-code, first install the Bitbucket app in Compass. You then designate a Bitbucket workspace where your repositories are located. Learn how to integrate Compass with Bitbucket Cloud
    • You can designate one Bitbucket workspace to one Compass instance.
    • You must be an admin of the Bitbucket workspace as well as in Compass to set this up.
  • In your source repository, declare a component’s details in a YAML configuration file called compass.yml. Each component has its own compass.yml file. Learn more about the structure and contents of a compass.yml file
  • Set up config-as-code for your component by placing the compass.yml file in a repository in your Bitbucket workspace. Learn how to manage components with config-as-code
    • When you commit your changes to the default branch of your repository, the component connects to the repository from where you’ll manage it.
    • You can also manage multiple Compass components from the same repository. Place the compass.yml files in separate subfolders anywhere in your repository structure.
  • Once you set up config-as-code for a component, the compass.yml file in your repository becomes the source of truth for all the component’s details.
    • You can manage the component by making changes only in the compass.yml file, not via the Compass UI or API.
    • When you commit the changes to your repository’s default branch, the changes automatically sync back to Compass and reflect in your component’s details.
    • You can update a component’s details by making changes in the compass.yml file. Learn how to update a component managed via config-as-code
  • At any time, you can disconnect a managed component from config-as-code.

Rate this page: