This provider can be used to create MongoDB resources.
- Clone the repository
- Enter the repository directory
- Build the provider using the Go
install
command:
go install .
provider "mongodb" {
url = "mongodb://localhost:27017"
}
The environment variable MONGODB_URL can be used instead.
The provider can be used to create indexes in a collection. The supported types of indexes are:
- Single Field Indexes
- Compound Indexes
- Multikey Indexes
- Geospatial Indexes
- Hashed Indexes
- Wildcard Indexes
The created indexes support the following properties
- Sparse Indexes
- TTL Indexes
- Unique
- Collations
- Background
You can find examples here
All supported index types can now be imported using terraform import <resource_path> <index_id>
.
Index id must use the format <database>.<collection>.<index_name>
.
This means that index id with database, collection or index containing
.
do NOT work.
Even though index collations and wildcard projections are supported when creating index
they do NOT work with import. The IndexSpecification
returned by the mongo driver when
fetching index data doesn't contain those fields so they cannot be inserted into the state.
Issue: KIABI-OSS#4