I am building a system that consists of multiple programs on many machines, some cloud services (such as RDS) and so on.
In an ideal world, I would like to supply some configuration (e.g. deployment keys, AWS credentials) and run a single "deploy all" command that will build and deploy everything.
I would also like it to be smart enough to not rebuild artefacts that have already been built or redeploy infrastructure that already exists.
Currently, I am using Bazel to build my artefacts (.so, .jar, Docker images, etc) and Terraform to provision my architecture (ECs, RDS, etc.).
Each of these tools is very good at what it does, and together, they cover builds and deployments. However, neither does everything (the desired "deploy all" command) and there are cases where they must interact in awkward ways.
For example, suppose I have a microservice written in JavaScript. This is compiled / bundled by Bazel. The bundle is then included in a Docker image along with some secrets generated by Terraform. The Docker image is built by Bazel. Finally, The Docker image is deployed using Terraform!
- Bazel builds the application code
- Terraform generates / fetches secrets
- Bazel builds a Docker image
- Terraform deploys the Docker image
I am jumping between the two tools and it doesn't feel like the right way to approach this.
- Should I wrap Terraform in Bazel and only interact with Bazel?
- Should I wrap Bazel in Terraform and only interact with Terraform?
- Should I use some third tool to manage them?
- How can I resolve this?