-
Notifications
You must be signed in to change notification settings - Fork 123
Add component template resource #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| --- | ||
| subcategory: "Index" | ||
| layout: "" | ||
| page_title: "Elasticstack: elasticstack_elasticsearch_component_template Resource" | ||
| description: |- | ||
| Creates or updates a component template. | ||
| --- | ||
|
|
||
| # Resource: elasticstack_elasticsearch_component_template | ||
|
|
||
| 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 | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| provider "elasticstack" { | ||
| elasticsearch {} | ||
| } | ||
|
|
||
| resource "elasticstack_elasticsearch_component_template" "my_template" { | ||
| name = "my_template" | ||
|
|
||
| template { | ||
| aliases { | ||
| name = "my_template_test" | ||
| } | ||
|
|
||
| settings = jsonencode({ | ||
| number_of_shards = "3" | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| resource "elasticstack_elasticsearch_index_template" "my_template" { | ||
| name = "my_data_stream" | ||
|
|
||
| index_patterns = ["stream*"] | ||
| composed_of = [elasticstack_elasticsearch_component_template.my_template.name] | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - **name** (String) Name of the component template to create. | ||
| - **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)) | ||
|
|
||
| ### Optional | ||
|
|
||
| - **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)) | ||
| - **metadata** (String) Optional user metadata about the component template. | ||
| - **version** (Number) Version number used to manage component templates externally. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - **id** (String) Internal identifier of the resource | ||
|
|
||
| <a id="nestedblock--template"></a> | ||
| ### Nested Schema for `template` | ||
|
|
||
| Optional: | ||
|
|
||
| - **alias** (Block Set) Alias to add. (see [below for nested schema](#nestedblock--template--alias)) | ||
| - **mappings** (String) Mapping for fields in the index. | ||
| - **settings** (String) Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings | ||
|
|
||
| <a id="nestedblock--template--alias"></a> | ||
| ### Nested Schema for `template.alias` | ||
|
|
||
| Required: | ||
|
|
||
| - **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 | ||
|
|
||
| Optional: | ||
|
|
||
| - **filter** (String) Query used to limit documents the alias can access. | ||
| - **index_routing** (String) Value used to route indexing operations to a specific shard. If specified, this overwrites the routing value for indexing operations. | ||
| - **is_hidden** (Boolean) If true, the alias is hidden. | ||
| - **is_write_index** (Boolean) If true, the index is the write index for the alias. | ||
| - **routing** (String) Value used to route indexing and search operations to a specific shard. | ||
| - **search_routing** (String) Value used to route search operations to a specific shard. If specified, this overwrites the routing value for search operations. | ||
|
|
||
|
|
||
|
|
||
| <a id="nestedblock--elasticsearch_connection"></a> | ||
| ### Nested Schema for `elasticsearch_connection` | ||
|
|
||
| Optional: | ||
|
|
||
| - **ca_file** (String) Path to a custom Certificate Authority certificate | ||
| - **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. | ||
| - **insecure** (Boolean) Disable TLS certificate validation | ||
| - **password** (String, Sensitive) A password to use for API authentication to Elasticsearch. | ||
| - **username** (String) A username to use for API authentication to Elasticsearch. | ||
|
|
||
| ## Import | ||
|
|
||
| Import is supported using the following syntax: | ||
|
|
||
| ```shell | ||
| terraform import elasticstack_elasticsearch_component_template.my_template <cluster_uuid>/<component_name> | ||
| ``` | ||
1 change: 1 addition & 0 deletions
1
examples/resources/elasticstack_elasticsearch_component_template/import.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| terraform import elasticstack_elasticsearch_component_template.my_template <cluster_uuid>/<component_name> |
24 changes: 24 additions & 0 deletions
24
examples/resources/elasticstack_elasticsearch_component_template/resource.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| provider "elasticstack" { | ||
| elasticsearch {} | ||
| } | ||
|
|
||
| resource "elasticstack_elasticsearch_component_template" "my_template" { | ||
| name = "my_template" | ||
|
|
||
| template { | ||
| aliases { | ||
| name = "my_template_test" | ||
| } | ||
|
|
||
| settings = jsonencode({ | ||
| number_of_shards = "3" | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| resource "elasticstack_elasticsearch_index_template" "my_template" { | ||
| name = "my_data_stream" | ||
|
|
||
| index_patterns = ["stream*"] | ||
| composed_of = [elasticstack_elasticsearch_component_template.my_template.name] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the documentation in the
docs/folder is generated and should not be changed manually. See how it's done fortemplateresource:terraform-provider-elasticstack/templates/resources/elasticsearch_index_template.md.tmpl
Lines 1 to 12 in 0beb7d4
you could copy this template and change the specific parts in names and the paths to the examples and run
make gento generate the required files, which you then can add into this PR as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used
make docs-generateto generate this file, but without adding the template file. I'll add it and regenete it the new documentation just after