Export from Terraform to MongoDB

CloudQuery is an open-source data integration platform that allows you to export data from any source to any destination.

The CloudQuery Terraform plugin allows you to sync data from Terraform to any destination, including MongoDB. It's free, open source, requires no account, and takes only minutes to get started.

Ready? Let's dive right in!

Step 1. Install the CloudQuery CLI

The CloudQuery CLI is a command-line tool that runs the sync. It supports MacOS, Linux and Windows.

brew install cloudquery/tap/cloudquery

Step 2. Configure the Terraform source plugin

Create a configuration file for the Terraform plugin and set up authentication.

Configuration

Create a file called terraform.yaml and add the following contents:

Fine-tune this configuration to match your needs. For more information, see the Terraform Plugin ↗ page in the docs.

Authentication

Step 3. Configure the MongoDB destination plugin

Create a configuration file for the MongoDB plugin and set up authentication.

Configuration

Create a file called mongodb.yaml and add the following contents:

Fine-tune this configuration to match your needs. For more information, see the MongoDB Plugin ↗ page in the docs.

Step 4. Start the Sync

Run the following command in your terminal to start the sync

And away we go! 🚀 The sync will run until completion, fetching all selected tables from Terraform. Any errors will be logged to a file called cloudquery.log.

Further Reading

Now that you've seen the basics of syncing Terraform to MongoDB, you should know that there's a lot more you can do. Check out the CloudQuery Documentation, Source Code and How-to Guides for more details.