terraform-provider-mongodb

command module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

README

Terraform Provider MongoDB

Release Acceptance Tests

01Joseph-Hwang10/terraform-provider-mongodb allows you to manage MongoDB databases, collections, documents, and indexes.

Quick Example

In this example, we will create a database, a collection, and a document in MongoDB.

First, add the provider to your Terraform configuration:

terraform {
  required_providers {
    mongodb = {
      source = "01Joseph-Hwang10/mongodb"
    }
  }
}

provider "mongodb" {
  uri = "<your-mongodb-connection-string>"
}

Then, create a database, a collection, and a document:

resource "mongodb_database" "default" {
  name          = "default"
  force_destroy = false
}

resource "mongodb_database_collection" "users" {
  database      = mongodb_database.default.name
  name          = "users"
  force_destroy = false
}

resource "mongodb_database_document" "first_user" {
  database   = mongodb_database.default.name
  collection = mongodb_database_collection.users.name
  document = jsonencode({
    name = "John Doe"
    age  = 25
  })
}

Finally, run terraform apply to create the database, collection, and document in MongoDB.

API Documentation

See the documentation for more information.

Contributing

Any contribution is welcome! Check out CONTRIBUTING.md and CODE_OF_CONDUCT.md for more information on how to get started.

License

terraform-provider-mongodb is licensed under a MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL