|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "elasticstack_elasticsearch_script Resource - terraform-provider-elasticstack" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Creates or updates a stored script or search template. See https://www.elastic.co/guide/en/elasticsearch/reference/current/create-stored-script-api.html |
| 7 | +--- |
| 8 | + |
| 9 | +# elasticstack_elasticsearch_script (Resource) |
| 10 | + |
| 11 | +Creates or updates a stored script or search template. See https://www.elastic.co/guide/en/elasticsearch/reference/current/create-stored-script-api.html |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +provider "elasticstack" { |
| 17 | + elasticsearch {} |
| 18 | +} |
| 19 | +
|
| 20 | +resource "elasticstack_elasticsearch_script" "my_script" { |
| 21 | + script_id = "my_script" |
| 22 | + source = "Math.log(_score * 2) + params['my_modifier']" |
| 23 | + context = "score" |
| 24 | +} |
| 25 | +``` |
| 26 | + |
| 27 | +<!-- schema generated by tfplugindocs --> |
| 28 | +## Schema |
| 29 | + |
| 30 | +### Required |
| 31 | + |
| 32 | +- `script_id` (String) Identifier for the stored script. Must be unique within the cluster. |
| 33 | +- `source` (String) For scripts, a string containing the script. For search templates, an object containing the search template. |
| 34 | + |
| 35 | +### Optional |
| 36 | + |
| 37 | +- `context` (String) Context in which the script or search template should run. |
| 38 | +- `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)) |
| 39 | +- `lang` (String) Script language. For search templates, use `mustache`. Defaults to `painless`. |
| 40 | + |
| 41 | +### Read-Only |
| 42 | + |
| 43 | +- `id` (String) The ID of this resource. |
| 44 | + |
| 45 | +<a id="nestedblock--elasticsearch_connection"></a> |
| 46 | +### Nested Schema for `elasticsearch_connection` |
| 47 | + |
| 48 | +Optional: |
| 49 | + |
| 50 | +- `api_key` (String, Sensitive) API Key to use for authentication to Elasticsearch |
| 51 | +- `ca_data` (String) PEM-encoded custom Certificate Authority certificate |
| 52 | +- `ca_file` (String) Path to a custom Certificate Authority certificate |
| 53 | +- `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. |
| 54 | +- `insecure` (Boolean) Disable TLS certificate validation |
| 55 | +- `password` (String, Sensitive) A password to use for API authentication to Elasticsearch. |
| 56 | +- `username` (String) A username to use for API authentication to Elasticsearch. |
| 57 | + |
| 58 | +## Import |
| 59 | + |
| 60 | +Import is supported using the following syntax: |
| 61 | + |
| 62 | +```shell |
| 63 | +terraform import elasticstack_elasticsearch_script.my_script <cluster_uuid>/<script id> |
| 64 | +``` |
0 commit comments