Skip to content

Commit

Permalink
Generate docs for script resource
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yomo committed Oct 30, 2022
1 parent 1df7326 commit 8f29b85
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
64 changes: 64 additions & 0 deletions docs/resources/elasticsearch_script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "elasticstack_elasticsearch_script Resource - terraform-provider-elasticstack"
subcategory: ""
description: |-
Creates or updates a stored script or search template. See https://www.elastic.co/guide/en/elasticsearch/reference/current/create-stored-script-api.html
---

# elasticstack_elasticsearch_script (Resource)

Creates or updates a stored script or search template. See https://www.elastic.co/guide/en/elasticsearch/reference/current/create-stored-script-api.html

## Example Usage

```terraform
provider "elasticstack" {
elasticsearch {}
}
resource "elasticstack_elasticsearch_script" "my_script" {
script_id = "my_script"
source = "Math.log(_score * 2) + params['my_modifier']"
context = "score"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `script_id` (String) Identifier for the stored script. Must be unique within the cluster.
- `source` (String) For scripts, a string containing the script. For search templates, an object containing the search template.

### Optional

- `context` (String) Context in which the script or search template should run.
- `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))
- `lang` (String) Script language. For search templates, use `mustache`. Defaults to `painless`.

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--elasticsearch_connection"></a>
### Nested Schema for `elasticsearch_connection`

Optional:

- `api_key` (String, Sensitive) API Key to use for authentication to Elasticsearch
- `ca_data` (String) PEM-encoded custom Certificate Authority certificate
- `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_script.my_script <cluster_uuid>/<script id>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import elasticstack_elasticsearch_script.my_script <cluster_uuid>/<script id>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
provider "elasticstack" {
elasticsearch {}
}

resource "elasticstack_elasticsearch_script" "my_script" {
script_id = "my_script"
source = "Math.log(_score * 2) + params['my_modifier']"
context = "score"
}

0 comments on commit 8f29b85

Please sign in to comment.