This repository is a Terraform MongoDB/DocumentDB provider forked from Kaginari/terraform-provider-mongodb.
terraform {
required_providers {
mongodb = {
source = "fabiovpcaumo/mongodb"
version = "x.y.z" # Specify your desired version here
}
}
}
provider "mongodb" {
# Configuration options
}
- Clone the repository
- Enter the repository directory
- Build the provider using the
make install
command:
git clone https://github.com/fabiovpcaumo/terraform-provider-mongodb
cd terraform-provider-mongodb
make install
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