Provider Registries
- OpenTofu Provider:
registry.opentofu.org/marqo-ai/marqo - Terraform Provider:
marqo-ai/marqoAvailable on the Terraform Registry - Source Code:
github.com/marqo-ai/terraform-provider-marqo
Platform Choice
The provider works identically on both platforms, with only minor differences in setup: Terraform:- Use provider source
marqo-ai/marqo, as in:
- Use
terraformcommands
- Use provider source
registry.opentofu.org/marqo-ai/marqo, as in:
- Use
tofucommands
Getting Started
Installation
- Install either Terraform or OpenTofu
- Create a new directory for your Marqo configuration(s)
- Create a
.tffile with your configuration (see examples below) - Create a
terraform.tfvarsfile with your API key as follows:
- Initialize your configuration using
terraformortofuinitcommand - Plan your configuration using
terraformortofuplancommand - Apply your configuration using
terraformortofuapplycommand
Some Basic Commands
| Terraform | OpenTofu | Description |
|---|---|---|
terraform init | tofu init | Initialize working directory |
terraform refresh | tofu refresh | Update state with remote changes |
terraform plan | tofu plan | Preview changes before applying |
terraform apply | tofu apply | Apply the planned changes |
terraform destroy | tofu destroy | Remove all resources |
Example directory structure for multiple indexes
If you only have one index, you can simply create a singlemarqo_index.tf file with the index configuration, resource, and output. Otherwise, you can follow the following structure:
main.tf contains the provider and data sources/resources, as in:
terraform.tfvars contains the API key, and marqo_index_unstructured.tf contains the unstructured index configuration as in:
output.tf file contains the output, as in:
Overview of Features
The marqo opentofu provider supports the following:- A datasource called
marqo_read_indicesthat allows you to read all of your marqo indexes in your account. - A resource called
marqo_indexthat allows you to create and manage a marqo index.
Sample Configuration for Unstructured Index Creation
Make sure that the host is set to"https://api.marqo.ai/api/v2"
- Creating an Unstructured Index
- Creating an Unstructured Index with Custom Models
- Creating a Structured Index
- Creating a Structured Audio/Video/Image Index
- Reading All Indexes in Your Account