Skip to content
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

fix example data in docs #166

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ resource "opensearch_index_template" "template_1" {
name = "template_1"
body = <<EOF
{
"template": "te*",
"settings": {
"number_of_shards": 1
},
"mappings": {
"type1": {
"index_patterns": [
"your-pattern-here-*"
],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"_source": {
"enabled": false
},
Expand Down Expand Up @@ -68,22 +72,22 @@ EOF
- `aws_profile` (String) The AWS profile for use with AWS OpenSearch Service domains
- `aws_region` (String) The AWS region for use in signing of AWS OpenSearch requests. Must be specified in order to use AWS URL signing with AWS OpenSearch endpoint exposed on a custom DNS domain.
- `aws_secret_key` (String) The secret key for use with AWS OpenSearch Service domains
- `aws_signature_service` (String) AWS service name used in the credential scope of signed requests to opensearch.
- `aws_signature_service` (String) AWS service name used in the credential scope of signed requests to OpenSearch.
- `aws_token` (String) The session token for use with AWS OpenSearch Service domains
- `cacert_file` (String) A Custom CA certificate
- `client_cert_path` (String) A X509 certificate to connect to opensearch
- `client_key_path` (String) A X509 key to connect to opensearch
- `healthcheck` (Boolean) Set the client healthcheck option for the opensearch client. Healthchecking is designed for direct access to the cluster.
- `host_override` (String) If provided, sets the 'Host' header of requests and the 'ServerName' for certificate validation to this value. See the documentation on connecting to opensearch via an SSH tunnel.
- `client_cert_path` (String) A X509 certificate to connect to OpenSearch
- `client_key_path` (String) A X509 key to connect to OpenSearch
- `healthcheck` (Boolean) Set the client healthcheck option for the OpenSearch client. Healthchecking is designed for direct access to the cluster.
- `host_override` (String) If provided, sets the 'Host' header of requests and the 'ServerName' for certificate validation to this value. See the documentation on connecting to OpenSearch via an SSH tunnel.
- `insecure` (Boolean) Disable SSL verification of API calls
- `opensearch_version` (String) opensearch Version
- `password` (String) Password to use to connect to opensearch using basic auth
- `proxy` (String) Proxy URL to use for requests to opensearch.
- `sign_aws_requests` (Boolean) Enable signing of AWS opensearch requests. The `url` must refer to AWS ES domain (`*.<region>.es.amazonaws.com`), or `aws_region` must be specified explicitly.
- `sniff` (Boolean) Set the node sniffing option for the opensearch client. Client won't work with sniffing if nodes are not routable.
- `opensearch_version` (String) OpenSearch Version
- `password` (String) Password to use to connect to OpenSearch using basic auth
- `proxy` (String) Proxy URL to use for requests to OpenSearch.
- `sign_aws_requests` (Boolean) Enable signing of AWS OpenSearch requests. The `url` must refer to AWS ES domain (`*.<region>.es.amazonaws.com`), or `aws_region` must be specified explicitly.
- `sniff` (Boolean) Set the node sniffing option for the OpenSearch client. Client won't work with sniffing if nodes are not routable.
- `token` (String) A bearer token or ApiKey for an Authorization header, e.g. Active Directory API key.
- `token_name` (String) The type of token, usually ApiKey or Bearer
- `username` (String) Username to use to connect to opensearch using basic auth
- `username` (String) Username to use to connect to OpenSearch using basic auth
- `version_ping_timeout` (Number) Version ping timeout in seconds

## Authentication
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/component_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "opensearch_component_template" "test" {
"template": {
"settings": {
"index": {
"number_of_shards": 1
"number_of_shards": "1"
}
},
"mappings": {
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/composable_index_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "opensearch_composable_index_template" "template_1" {
"template": {
"settings": {
"index": {
"number_of_shards": 1
"number_of_shards": "1"
}
},
"mappings": {
Expand Down
19 changes: 7 additions & 12 deletions docs/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,15 @@ Provides an OpenSearch index resource.

```terraform
# Create a simple index
resource "opensearch_index" "test" {
resource "opensearch_index" "test-simple-index" {
name = "terraform-test"
number_of_shards = 1
number_of_replicas = 1
number_of_shards = "1"
number_of_replicas = "1"
mappings = <<EOF
{
"people": {
"_all": {
"enabled": false
},
"properties": {
"email": {
"type": "text"
}
"properties": {
"name": {
"type": "text"
}
}
}
Expand Down Expand Up @@ -64,7 +59,7 @@ EOF
- `highlight_max_analyzed_offset` (String) The maximum number of characters that will be analyzed for a highlight request. A stringified number.
- `include_type_name` (String) A string that indicates if and what we should pass to include_type_name parameter. Set to `"false"` when trying to create an index on a v6 cluster without a doc type or set to `"true"` when trying to create an index on a v7 cluster with a doc type. Since mapping updates are not currently supported, this applies only on index create.
- `index_knn` (Boolean) Indicates whether the index should build native library indices for the knn_vector fields. If set to false, the knn_vector fields will be stored in doc values, but Approximate k-NN search functionality will be disabled.
- `index_knn_algo_param_ef_search` (String) The size of the dynamic list used during k-NN searches. Higher values lead to more accurate but slower searches. Only available for `nmslib` implementation.
- `index_knn_algo_param_ef_search` (String) The size of the dynamic list used during k-NN searches. Higher values lead to more accurate but slower searches. Only available for nmslib.
- `index_similarity_default` (String) A JSON string describing the default index similarity config.
- `indexing_slowlog_level` (String) Set which logging level to use for the search slow log, can be: `warn`, `info`, `debug`, `trace`
- `indexing_slowlog_source` (String) Set the number of characters of the `_source` to include in the slowlog lines, `false` or `0` will skip logging the source entirely and setting it to `true` will log the entire source regardless of size. The original `_source` is reformatted by default to make sure that it fits on a single log line.
Expand Down
33 changes: 19 additions & 14 deletions docs/resources/index_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,27 @@ resource "opensearch_index_template" "template_1" {
name = "template_1"
body = <<EOF
{
"template": "te*",
"settings": {
"number_of_shards": 1
},
"mappings": {
"type1": {
"_source": {
"enabled": false
},
"index_patterns": [
"logs-2020-01-*"
],
"template": {
"aliases": {
"my_logs": {}
},
"settings": {
"index": {
"number_of_shards": "2",
"number_of_replicas": "1"
}
},
"mappings": {
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"timestamp": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z YYYY"
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
},
"value": {
"type": "double"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions docs/resources/ism_policy_mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ page_title: "opensearch_ism_policy_mapping Resource - terraform-provider-opensea
subcategory: ""
description: |-
Provides an OpenSearch Index State Management (ISM) policy. Please refer to the OpenSearch ISM documentation for details.
!> opensearch_ism_policy_mapping is deprecated in OpenSearch 1.x please use the opensearch_ism_policy resource and specify the ism_template attribute in the policies instead.
---

# opensearch_ism_policy_mapping (Resource)

Provides an OpenSearch Index State Management (ISM) policy. Please refer to the OpenSearch ISM documentation for details.

!> `opensearch_ism_policy_mapping` is deprecated in OpenSearch 1.x please use the `opensearch_ism_policy` resource and specify the `ism_template` attribute in the policies instead.

## Example Usage

```terraform
Expand Down
16 changes: 10 additions & 6 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ resource "opensearch_index_template" "template_1" {
name = "template_1"
body = <<EOF
{
"template": "te*",
"settings": {
"number_of_shards": 1
},
"mappings": {
"type1": {
"index_patterns": [
"your-pattern-here-*"
],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"_source": {
"enabled": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "opensearch_component_template" "test" {
"template": {
"settings": {
"index": {
"number_of_shards": 1
"number_of_shards": "1"
}
},
"mappings": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "opensearch_composable_index_template" "template_1" {
"template": {
"settings": {
"index": {
"number_of_shards": 1
"number_of_shards": "1"
}
},
"mappings": {
Expand Down
6 changes: 3 additions & 3 deletions examples/resources/opensearch_index/resource.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Create a simple index
resource "opensearch_index" "test" {
resource "opensearch_index" "test-simple-index" {
name = "terraform-test"
number_of_shards = 1
number_of_replicas = 1
number_of_shards = "1"
number_of_replicas = "1"
mappings = <<EOF
{
"properties": {
Expand Down
6 changes: 6 additions & 0 deletions examples/resources/opensearch_index_template/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ resource "opensearch_index_template" "template_1" {
"aliases": {
"my_logs": {}
},
"settings": {
"index": {
"number_of_shards": "2",
"number_of_replicas": "1"
}
},
"mappings": {
"properties": {
"timestamp": {
Expand Down
40 changes: 20 additions & 20 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

type ServerFlavor int64

// opensearch
// OpenSearch
const (
Unknown ServerFlavor = iota
OpenSearch
Expand Down Expand Up @@ -78,31 +78,31 @@ func Provider() *schema.Provider {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_URL", nil),
Description: "Opensearch URL",
Description: "OpenSearch URL",
},
"sniff": {
Type: schema.TypeBool,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_SNIFF", false),
Description: "Set the node sniffing option for the opensearch client. Client won't work with sniffing if nodes are not routable.",
Description: "Set the node sniffing option for the OpenSearch client. Client won't work with sniffing if nodes are not routable.",
},
"healthcheck": {
Type: schema.TypeBool,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_HEALTH", true),
Description: "Set the client healthcheck option for the opensearch client. Healthchecking is designed for direct access to the cluster.",
Description: "Set the client healthcheck option for the OpenSearch client. Healthchecking is designed for direct access to the cluster.",
},
"username": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_USERNAME", nil),
Description: "Username to use to connect to opensearch using basic auth",
Description: "Username to use to connect to OpenSearch using basic auth",
},
"password": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_PASSWORD", nil),
Description: "Password to use to connect to opensearch using basic auth",
Description: "Password to use to connect to OpenSearch using basic auth",
},
"token": {
Type: schema.TypeString,
Expand Down Expand Up @@ -132,31 +132,31 @@ func Provider() *schema.Provider {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The access key for use with AWS opensearch Service domains",
Description: "The access key for use with AWS OpenSearch Service domains",
},
"aws_secret_key": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The secret key for use with AWS opensearch Service domains",
Description: "The secret key for use with AWS OpenSearch Service domains",
},
"aws_token": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The session token for use with AWS opensearch Service domains",
Description: "The session token for use with AWS OpenSearch Service domains",
},
"aws_profile": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The AWS profile for use with AWS opensearch Service domains",
Description: "The AWS profile for use with AWS OpenSearch Service domains",
},
"aws_region": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The AWS region for use in signing of AWS opensearch requests. Must be specified in order to use AWS URL signing with AWS OpenSearch endpoint exposed on a custom DNS domain.",
Description: "The AWS region for use in signing of AWS OpenSearch requests. Must be specified in order to use AWS URL signing with AWS OpenSearch endpoint exposed on a custom DNS domain.",
},
"cacert_file": {
Type: schema.TypeString,
Expand All @@ -174,36 +174,36 @@ func Provider() *schema.Provider {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "A X509 certificate to connect to opensearch",
Description: "A X509 certificate to connect to OpenSearch",
DefaultFunc: schema.EnvDefaultFunc("OS_CLIENT_CERTIFICATE_PATH", ""),
},
"client_key_path": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "A X509 key to connect to opensearch",
Description: "A X509 key to connect to OpenSearch",
DefaultFunc: schema.EnvDefaultFunc("OS_CLIENT_KEY_PATH", ""),
},
"sign_aws_requests": {
Type: schema.TypeBool,
Optional: true,
Default: true,
Description: "Enable signing of AWS opensearch requests. The `url` must refer to AWS ES domain (`*.<region>.es.amazonaws.com`), or `aws_region` must be specified explicitly.",
Description: "Enable signing of AWS OpenSearch requests. The `url` must refer to AWS ES domain (`*.<region>.es.amazonaws.com`), or `aws_region` must be specified explicitly.",
},
"aws_signature_service": {
Type: schema.TypeString,
Optional: true,
Default: "es",
Description: "AWS service name used in the credential scope of signed requests to opensearch.",
Description: "AWS service name used in the credential scope of signed requests to OpenSearch.",
},
"opensearch_version": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "opensearch Version",
Description: "OpenSearch Version",
},
// version_ping_timeout is the time the ping to check the cluster
// version waits for a response from opensearch on startup, e.g. when
// version waits for a response from OpenSearch on startup, e.g. when
// creating a provider.
"version_ping_timeout": {
Type: schema.TypeInt,
Expand All @@ -215,12 +215,12 @@ func Provider() *schema.Provider {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "If provided, sets the 'Host' header of requests and the 'ServerName' for certificate validation to this value. See the documentation on connecting to opensearch via an SSH tunnel.",
Description: "If provided, sets the 'Host' header of requests and the 'ServerName' for certificate validation to this value. See the documentation on connecting to OpenSearch via an SSH tunnel.",
},
"proxy": {
Type: schema.TypeString,
Optional: true,
Description: "Proxy URL to use for requests to opensearch.",
Description: "Proxy URL to use for requests to OpenSearch.",
},
},

Expand Down Expand Up @@ -421,7 +421,7 @@ func getClient(conf *ProviderConf) (*elastic7.Client, error) {
conf.flavor = OpenSearch
}
} else if conf.flavor == Unknown || conf.osVersion < "1.0.0" {
return nil, fmt.Errorf("opensearch version %s is older than 1.0.0 and is not supported, flavor: %v.", conf.osVersion, conf.flavor)
return nil, fmt.Errorf("OpenSearch version %s is older than 1.0.0 and is not supported, flavor: %v.", conf.osVersion, conf.flavor)
}

return client, nil
Expand Down
2 changes: 1 addition & 1 deletion provider/resource_opensearch_index_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

func resourceOpensearchIndexTemplate() *schema.Resource {
return &schema.Resource{
Description: "Provides an Opensearch index template resource.",
Description: "Provides an OpenSearch index template resource.",
Create: resourceOpensearchIndexTemplateCreate,
Read: resourceOpensearchIndexTemplateRead,
Update: resourceOpensearchIndexTemplateUpdate,
Expand Down
Loading
Loading