I have complex stack which consists of infrastructure, application and config parts, which are deployed to datacenters around the world. We have custom inhouse configuration system, based on database which is replicated elsewhere.
We have loads of configuration, which depends on our infrastructure - i.e. database connection strings, application specific configuration etc. Right now all this config is managed by hand, and drifts a lot. It's hard to say which config is still required and which can be decommissioned, it's hard to ensure exactly the same changes go from test environment to production, and that all environments were updated.
I wonder how can I improve this situation. I would like to have single source of truth in form of git repository, which can then be deployed to multiple datacenters (with some templating of variable substitution).
When I read this requirements, I think terraform with some kind of sql CRUD provider would be perfect tool:
- stored in git
- infra is already defined there, so pushing stuff like database connection strings is easy
- can review changes
- no manually configuring data in the system
- easy replication across environments
System based on database has to stay (too much code depends on that). Of course there is other data in the database, which changes a lot or is customer specific, and would not be managed by this setup.
Does it make sense to use terraform in such way?
Other tools I've checked:
- Ansible
- Salt
- Chef
- Puppet
All these tools were built with similar setup, however I see following downsides:
- Would have to push infrastructure identifiers into these tools (which is repetitive and error-prone)
- These are complex tools, which would have to be deployed alongside terraform
- These tools do not track state and changes, so it's not possible to see what I'm changing (i.e. terraform plan)
- When infrastructure is provisioned there is separate bootstrapping process to register in configuration tool