Creating an OpenSearch Cluster using Terraform

This document serves as a supplement to the existing Terraform documentation for OpenSearch, with the aim of offering an in-depth understanding of specific schema blocks and providing additional examples for creating an OpenSearch cluster using these blocks.

To understand how OpenSearch node roles behave, refer to the OpenSearch documentation on node roles. 

Table of Contents

Terminology

  1. Cluster manager eligible node”: nodes that contain the “cluster_manager”  (previously known as “master”) role and can contain other roles, such as “data” or “ingest”.
  2. Dedicated cluster manager nodes”: nodes that solely contain the “cluster_manager” (previously known as “master”) role and excludes other roles such as “data” or “ingest”.
  3. Data + ingest nodes”: nodes that contain the roles “data” and “ingest” while excluding other roles such as “cluster_manager”.
  4. Dedicated data nodes”: nodes that exclusively contain the “data” role, without taking on other roles such as “cluster_manager” or “ingest”.
  5. Dedicated ingest nodes”: nodes that exclusively have the “ingest” role, without other roles such as “data” or “cluster_manager”. 

Schema blocks in the OpenSearch resource

  1. cluster_manager_nodes” block: This is a mandatory nested block required regardless of whether the OpenSearch cluster is provisioned with or without dedicated cluster manager nodes.
    1. a. When the “dedicated_manager” field within this block is set to false, an OpenSearch cluster featuring cluster manager eligible nodes will be provisioned.
    2. b. When the “dedicated_manager” field in this block is set to true, an OpenSearch cluster with dedicated cluster manager nodes will be provisioned. This setting necessitates specifying the “data_nodes” block, as provisioning a cluster solely with cluster manager nodes is not permissible.
  2. data_nodes” block: This is an optional nested block to assist with provisioning of data nodes. However, it becomes mandatory when provisioning the OpenSearch cluster with dedicated cluster manager nodes
  3. ingest_nodes” block: This is an optional nested block that facilitates the provisioning of dedicated ingest nodes

 

An overview of how the cluster will be provisioned when using the various schema blocks mentioned above is as follows: 

Scenario 

dedicated_manager flag  data_nodes defined?* 

ingest_nodes defined?* 

Result 
1     

 

3 x dedicated cluster manager nodes with the role – “cluster_manager”
+
3 x dedicated data nodes with the role – “data”
+
3 x dedicated ingest nodes with the role – “ingest” 

2 

   

 

3 x cluster manager eligible nodes with roles – “cluster_manager”, “data”, “ingest”

3 

   

 

3 x cluster manager eligible nodes with roles – “cluster_manager”, “data”, “ingest”
+
3 x data + ingest nodes with roles – “data”, “ingest” 

4 

   

 

3 x cluster manager eligible nodes with roles – “cluster_manager” and “data”
+
3 x dedicated ingest nodes with the role – “ingest” 

5 

   

 

3 x dedicated cluster manager nodes with the role – “cluster_manager”
+
3 x data + ingest nodes with roles – “data”, “ingest” 

6 

   

 

3 x cluster manager eligible nodes with roles – “cluster_manager” and “data”
+
3 x dedicated data nodes with the role – “data”
+
3 x dedicated ingest nodes with the role – “ingest” 

7 

   

 

Invalid combination, due to missing “data_nodes” block when “dedicated_manager = true” 

8 

   

 

Invalid combination, due to missing “data_nodes” block when “dedicated_manager = true” 

* Assumes “node_count = 3”

Examples

The following are set examples covering common use-cases:

Scenario 1: Provision an OpenSearch cluster with 3 dedicated manager nodes, 3 dedicated data nodes and 3 dedicated ingest nodes 

This example provisions a 9-node cluster, with 3 dedicated manager nodes assigned with the role of “cluster_manager”, and 3 dedicated data nodes with the role “data”, and 3 dedicated ingest nodes with the role of “ingest”. 

Scenario 2: Provision an OpenSearch cluster with 3 cluster manager eligible nodes  

This example provisions a 3-node cluster, with each node assigned with the roles of “data”, “ingest” and “cluster_manager”. These nodes are known as the cluster manager eligible nodes.  

Scenario 3: Provision an OpenSearch cluster with 3 cluster manager eligible nodes and 3 data + ingest nodes 

This example provisions a 6-node cluster, with 3 cluster manager eligible nodes assigned with the roles of “data”, “ingest” and “cluster_manager”, and 3 data + ingest nodes assigned with the roles “data” and “ingest”. 

Scenario 5: Provision an OpenSearch cluster with 3 dedicated manager nodes and 3 data + ingest nodes 

This example provisions a 6-node cluster, with 3 dedicated manager nodes assigned with the role of “cluster_manager”, and 3 data + ingest nodes assigned with the roles “data” and “ingest”. 

 

Contact Instaclustr Support if there are any questions or issues with provisioning your cluster with the Instaclustr Terraform Provider V2. 

By Instaclustr Support
Need Support?
Experiencing difficulties on the website or console?
Already have an account?
Need help with your cluster?
Contact Support
Why sign up?
To experience the ease of creating and managing clusters via the Instaclustr Console
Spin up a cluster in minutes