|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "elasticstack_elasticsearch_component_template Resource - terraform-provider-elasticstack" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Creates or updates a component template. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html |
| 7 | +--- |
| 8 | + |
| 9 | +# elasticstack_elasticsearch_component_template (Resource) |
| 10 | + |
| 11 | +Creates or updates a component template. Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-component-template.html |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +provider "elasticstack" { |
| 17 | + elasticsearch {} |
| 18 | +} |
| 19 | +
|
| 20 | +resource "elasticstack_elasticsearch_component_template" "my_template" { |
| 21 | + name = "my_template" |
| 22 | +
|
| 23 | + template { |
| 24 | + aliases { |
| 25 | + name = "my_template_test" |
| 26 | + } |
| 27 | +
|
| 28 | + settings = jsonencode({ |
| 29 | + number_of_shards = "3" |
| 30 | + }) |
| 31 | + } |
| 32 | +} |
| 33 | +
|
| 34 | +resource "elasticstack_elasticsearch_index_template" "my_template" { |
| 35 | + name = "my_data_stream" |
| 36 | +
|
| 37 | + index_patterns = ["stream*"] |
| 38 | + composed_of = [elasticstack_elasticsearch_component_template.my_template.name] |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +<!-- schema generated by tfplugindocs --> |
| 43 | +## Schema |
| 44 | + |
| 45 | +### Required |
| 46 | + |
| 47 | +- **name** (String) Name of the component template to create. |
| 48 | +- **template** (Block List, Min: 1, Max: 1) Template to be applied. It may optionally include an aliases, mappings, or settings configuration. (see [below for nested schema](#nestedblock--template)) |
| 49 | + |
| 50 | +### Optional |
| 51 | + |
| 52 | +- **elasticsearch_connection** (Block List, Max: 1) Used to establish connection to Elasticsearch server. Overrides environment variables if present. (see [below for nested schema](#nestedblock--elasticsearch_connection)) |
| 53 | +- **id** (String) The ID of this resource. |
| 54 | +- **metadata** (String) Optional user metadata about the component template. |
| 55 | +- **version** (Number) Version number used to manage component templates externally. |
| 56 | + |
| 57 | +<a id="nestedblock--template"></a> |
| 58 | +### Nested Schema for `template` |
| 59 | + |
| 60 | +Optional: |
| 61 | + |
| 62 | +- **alias** (Block Set) Alias to add. (see [below for nested schema](#nestedblock--template--alias)) |
| 63 | +- **mappings** (String) Mapping for fields in the index. |
| 64 | +- **settings** (String) Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings |
| 65 | + |
| 66 | +<a id="nestedblock--template--alias"></a> |
| 67 | +### Nested Schema for `template.alias` |
| 68 | + |
| 69 | +Required: |
| 70 | + |
| 71 | +- **name** (String) The alias name. Index alias names support date math. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/date-math-index-names.html |
| 72 | + |
| 73 | +Optional: |
| 74 | + |
| 75 | +- **filter** (String) Query used to limit documents the alias can access. |
| 76 | +- **index_routing** (String) Value used to route indexing operations to a specific shard. If specified, this overwrites the routing value for indexing operations. |
| 77 | +- **is_hidden** (Boolean) If true, the alias is hidden. |
| 78 | +- **is_write_index** (Boolean) If true, the index is the write index for the alias. |
| 79 | +- **routing** (String) Value used to route indexing and search operations to a specific shard. |
| 80 | +- **search_routing** (String) Value used to route search operations to a specific shard. If specified, this overwrites the routing value for search operations. |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +<a id="nestedblock--elasticsearch_connection"></a> |
| 85 | +### Nested Schema for `elasticsearch_connection` |
| 86 | + |
| 87 | +Optional: |
| 88 | + |
| 89 | +- **ca_file** (String) Path to a custom Certificate Authority certificate |
| 90 | +- **endpoints** (List of String, Sensitive) A list of endpoints the Terraform provider will point to. They must include the http(s) schema and port number. |
| 91 | +- **insecure** (Boolean) Disable TLS certificate validation |
| 92 | +- **password** (String, Sensitive) A password to use for API authentication to Elasticsearch. |
| 93 | +- **username** (String) A username to use for API authentication to Elasticsearch. |
| 94 | + |
| 95 | +## Import |
| 96 | + |
| 97 | +Import is supported using the following syntax: |
| 98 | + |
| 99 | +```shell |
| 100 | +terraform import elasticstack_elasticsearch_component_template.my_template <cluster_uuid>/<component_name> |
| 101 | +``` |
0 commit comments