# Deploy text embedding model via terraform

**URL:** <https://discuss.elastic.co/t/deploy-text-embedding-model-via-terraform/373074>\
**Category:** Terraform\
**Tags:** elastic-stack-machine-learning\
**Created:** [January 10, 2025, 3:53pm UTC](https://discuss.elastic.co/t/deploy-text-embedding-model-via-terraform/373074 "2025-01-10T15:53:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaroslav\_Nejedly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaroslav_nejedly/32/139184_2.png) [@Jaroslav\_Nejedly](https://discuss.elastic.co/u/Jaroslav_Nejedly)\
**Post date:** [January 10, 2025, 3:53pm UTC](https://discuss.elastic.co/t/deploy-text-embedding-model-via-terraform/373074/1 "2025-01-10T15:53:15Z")

</div>

Hi!

What is the best way to deploy a text embedding model using Terraform? (If you think it should not be done via Terraform at all: What is the best way to automatically deploy a text embedding model to ensure it's always there when elastic is deployed?)

I have created a python script that installs eland, and then uses `eland_import_hub_model` to install `intfloat/multilingual-e5-large` to elastic. Then I use `null_resource` in terraform to execute the script.

However, since we are not controlling our own terraform I am not even sure if python is installed on the machine and figured I probably need a better way of doing that. I need to do it in a way I know will always work regardless where Terraform is running.

Do you have any suggestions?

---

<div class="post-metadata">

**Author:** ![iulia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iulia/32/124658_2.png) [@iulia](https://discuss.elastic.co/u/iulia)\
**Post date:** [February 20, 2025, 9:58am UTC](https://discuss.elastic.co/t/deploy-text-embedding-model-via-terraform/373074/2 "2025-02-20T09:58:28Z")

</div>

Hi!

Here are a few thoughts.

First, there are some resources like the [teraform elasticstak](https://registry.terraform.io/providers/elastic/elasticstack/latest/docs) to help with more common elastic actions w/ terraform that you can take a look at.  
At the moment, they don't have specific functionalities within that stack to handle model deployment - but there is [a fearture request](https://github.com/elastic/terraform-provider-elasticstack/issues/725) for it.

In the meantime, if you want to avoid the python dependency question, you can install the model [via an API call](https://www.elastic.co/guide/en/machine-learning/master/ml-nlp-e5.html#dev-console-e5) instead from your terraform:

```auto

PUT _ml/trained_models/.multilingual-e5-small
{
  "input": {
	"field_names": ["text_field"]
  }
}

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Jaroslav\_Nejedly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaroslav_nejedly/32/139184_2.png) [@Jaroslav\_Nejedly](https://discuss.elastic.co/u/Jaroslav_Nejedly)\
**Post date:** [May 22, 2025, 11:14am UTC](https://discuss.elastic.co/t/deploy-text-embedding-model-via-terraform/373074/3 "2025-05-22T11:14:07Z")

</div>

Thank you for the info
