Skip to content

Latest commit

 

History

History
89 lines (60 loc) · 2.66 KB

File metadata and controls

89 lines (60 loc) · 2.66 KB

Terraform Provider MongoDB driver

REUSE status

Manage MongoDB itself using MongoDB driver.

Using the provider

TODO

Development

If you wish to work on the provider, you'll first need Go installed on your machine (see Development requirements below).

To compile the provider, run go install. This will build the provider and put the provider binary in the $GOPATH/bin directory (default: ~/go/bin).

To generate or update documentation, run go generate.

To run the tests, run make test.

Development requirements

  • Tofu >= 1.6.0-alpha1
  • Go >= 1.21

Building The Provider

  1. Clone the repository

  2. Enter the repository directory

  3. Build the provider using the Go install command:

    go install
  4. Tell Terraform via ~/.terraformrc to use the locally built version of the provider: (must use absolute path, Terraform does not understand ~/go/bin)

    // File: ~/.terraformrc
    provider_installation {
      dev_overrides {
        "registry.terraform.io/RiskIdent/mongodb-driver" = "/home/<your username>/go/bin"
        "registry.opentofu.org/RiskIdent/mongodb-driver" = "/home/<your username>/go/bin"
      }
      direct {}
    }

Testing

First start MongoDB locally, such as via Podman:

podman run -d --rm -p 27017:27017 --name mongo mongo

Then run the Go tests with the TF_ACC=1 environment variable set:

TF_ACC=1 go test -count=1 ./...

The MongoDB URI that the tests try to access can be overridden with the MONGODB_URI environment variable.

License

This repository complies with the REUSE recommendations.

Different licenses are used for different files. In general:

Please see each file's header or accompanied .license file for specifics. The generated documentation found in the docs directory have their licenses marked by the .reuse/dep5 file.