Automate Creating New Database Connections

We’re working on a system in GCP where we have many different projects (multiples of each tier: Dev, Test, Staging, Prod) and we are regularly destroying old and creating new projects via Terraform. Our Ignition gateway is not a part of these projects and exists in a separate instance that is never destroyed (actually running in AWS). This Ignition gateway needs to connect to all of the MySQL DB instances in every GCP project. With the GCP project creation/destruction being automated it is a bit of a pain to have to create new DB connections to these MySQL instances manually in Ignition. Any thoughts or pointers on how we might be able to make DB connections dynamic/automated?

I’m guessing this isn’t possible outside of a custom module, but figured it’s worth asking. It sounds like future licensing changes may give us some more flexibility here and I may explore having the Ignition gateway included as a separate instance in each GCP project…

There’s nothing (exposed, supported) in Ignition to dynamically configure DB connections - but could you use a middleman/routing server that (transparent to Ignition) routes to the appropriate DB instance(s) automatically? @MMaynard’s answer is better :slight_smile:

1 Like

Isn’t that what system.db.addDatasource and system.db.removeDatasource are used for?


Oh wow! I didn’t even realize these existed…this looks like exactly what we need. Thanks!