Skip to content

Terraform provider for mongodb instance (selfhosted, AWS documentDB and cloud instances )

License

Notifications You must be signed in to change notification settings

beam-aimar/terraform-provider-mongodb

 
 

Repository files navigation

Terraform Provider Mongodb

GitHub go.mod Go version GitHub release (latest by date) GitHub GitHub Workflow Status GitHub issues

This repository is a Terraform MongoDB/DocumentDB provider forked from Kaginari/terraform-provider-mongodb.

Using the provider

terraform {
  required_providers {
    mongodb = {
      source = "fabiovpcaumo/mongodb"
      version = "x.y.z" # Specify your desired version here
    }
  }
}

provider "mongodb" {
  # Configuration options
}

Requirements

Installation

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the make install command:
git clone https://github.com/fabiovpcaumo/terraform-provider-mongodb
cd terraform-provider-mongodb
make install

To test the provider locally

1.1: start the docker-compose

cd docker
docker-compose up -d

1.2 : create admin user in mongo

$ docker exec -it mongo bash
> mongo
> use admin
> db.createUser({ user: "root" , pwd: "root", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})

1.3 : accessing the local MongoDB via Mongo Express

By default, the docker compose exposes a Mongo Express container at localhost:8081.

2: Build the provider

follow the Installation

3: Use the provider

You are now ready to use the local provider as you like.

For an example code you can use:

cd examples
make apply

About

Terraform provider for mongodb instance (selfhosted, AWS documentDB and cloud instances )

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 96.8%
  • Makefile 3.2%