We keep all our Terraform files under the terraform directory.
Terraform allows to reuse definitions across environments. We thus don't have to have a set of definitions for provisioning Onadata resources in the production environment and a different set of definitions for provisioning Onadata resources in the staging environment. How we go about this is by creating a shared Terraform module for our setup, then including this module in Terraform files corresponding to each of the environments we plan to deploy the setup.
The following subsections will take you through how to codify your setup using Terraform, the Ona way. As a reference, we will use Onadata's Terraform files:
1. Create a Reusable Module
Keep the Terraform resource blocks for your setup in
../terraform/modules/<Name of setup>. For instance, the Onadata setup's resource blocks are kept in terraform/modules/onadata. Then isolate the Ter