Skip to content

Commit bdb5b5f

Browse files
authored
change resource and example instead of generated docs
Signed-off-by: Lorenzo <[email protected]> Signed-off-by: GitHub <[email protected]>
1 parent 51ad760 commit bdb5b5f

File tree

14 files changed

+71
-63
lines changed

14 files changed

+71
-63
lines changed

docs/index.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,22 @@ EOF
7272
- `aws_profile` (String) The AWS profile for use with AWS OpenSearch Service domains
7373
- `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.
7474
- `aws_secret_key` (String) The secret key for use with AWS OpenSearch Service domains
75-
- `aws_signature_service` (String) AWS service name used in the credential scope of signed requests to opensearch.
75+
- `aws_signature_service` (String) AWS service name used in the credential scope of signed requests to OpenSearch.
7676
- `aws_token` (String) The session token for use with AWS OpenSearch Service domains
7777
- `cacert_file` (String) A Custom CA certificate
78-
- `client_cert_path` (String) A X509 certificate to connect to opensearch
79-
- `client_key_path` (String) A X509 key to connect to opensearch
80-
- `healthcheck` (Boolean) Set the client healthcheck option for the opensearch client. Healthchecking is designed for direct access to the cluster.
81-
- `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.
78+
- `client_cert_path` (String) A X509 certificate to connect to OpenSearch
79+
- `client_key_path` (String) A X509 key to connect to OpenSearch
80+
- `healthcheck` (Boolean) Set the client healthcheck option for the OpenSearch client. Healthchecking is designed for direct access to the cluster.
81+
- `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.
8282
- `insecure` (Boolean) Disable SSL verification of API calls
83-
- `opensearch_version` (String) opensearch Version
84-
- `password` (String) Password to use to connect to opensearch using basic auth
85-
- `proxy` (String) Proxy URL to use for requests to opensearch.
86-
- `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.
87-
- `sniff` (Boolean) Set the node sniffing option for the opensearch client. Client won't work with sniffing if nodes are not routable.
83+
- `opensearch_version` (String) OpenSearch Version
84+
- `password` (String) Password to use to connect to OpenSearch using basic auth
85+
- `proxy` (String) Proxy URL to use for requests to OpenSearch.
86+
- `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.
87+
- `sniff` (Boolean) Set the node sniffing option for the OpenSearch client. Client won't work with sniffing if nodes are not routable.
8888
- `token` (String) A bearer token or ApiKey for an Authorization header, e.g. Active Directory API key.
8989
- `token_name` (String) The type of token, usually ApiKey or Bearer
90-
- `username` (String) Username to use to connect to opensearch using basic auth
90+
- `username` (String) Username to use to connect to OpenSearch using basic auth
9191
- `version_ping_timeout` (Number) Version ping timeout in seconds
9292

9393
## Authentication

docs/resources/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resource "opensearch_index" "test-simple-index" {
2121
mappings = <<EOF
2222
{
2323
"properties": {
24-
"email": {
24+
"name": {
2525
"type": "text"
2626
}
2727
}
@@ -59,7 +59,7 @@ EOF
5959
- `highlight_max_analyzed_offset` (String) The maximum number of characters that will be analyzed for a highlight request. A stringified number.
6060
- `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.
6161
- `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.
62-
- `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.
62+
- `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.
6363
- `index_similarity_default` (String) A JSON string describing the default index similarity config.
6464
- `indexing_slowlog_level` (String) Set which logging level to use for the search slow log, can be: `warn`, `info`, `debug`, `trace`
6565
- `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.

docs/resources/index_template.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,24 @@ resource "opensearch_index_template" "template_1" {
1919
body = <<EOF
2020
{
2121
"index_patterns": [
22-
"your-pattern-here-*"
22+
"logs-2020-01-*"
2323
],
2424
"template": {
25+
"aliases": {
26+
"my_logs": {}
27+
},
2528
"settings": {
26-
"index": {
27-
"number_of_shards": "1"
28-
}
29+
"number_of_shards": "2",
30+
"number_of_replicas": "1"
2931
},
3032
"mappings": {
31-
"_source": {
32-
"enabled": false
33-
},
3433
"properties": {
35-
"host_name": {
36-
"type": "keyword"
37-
},
38-
"created_at": {
34+
"timestamp": {
3935
"type": "date",
40-
"format": "EEE MMM dd HH:mm:ss Z YYYY"
36+
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
37+
},
38+
"value": {
39+
"type": "double"
4140
}
4241
}
4342
}

docs/resources/ism_policy_mapping.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ page_title: "opensearch_ism_policy_mapping Resource - terraform-provider-opensea
44
subcategory: ""
55
description: |-
66
Provides an OpenSearch Index State Management (ISM) policy. Please refer to the OpenSearch ISM documentation for details.
7+
!> 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.
78
---
89

9-
!> **NOTE:** `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.
10-
1110
# opensearch_ism_policy_mapping (Resource)
1211

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

14+
!> `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.
15+
1516
## Example Usage
1617

1718
```terraform

examples/provider/provider.tf

+10-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ resource "opensearch_index_template" "template_1" {
88
name = "template_1"
99
body = <<EOF
1010
{
11-
"template": "te*",
12-
"settings": {
13-
"number_of_shards": 1
14-
},
15-
"mappings": {
16-
"type1": {
11+
"index_patterns": [
12+
"your-pattern-here-*"
13+
],
14+
"template": {
15+
"settings": {
16+
"index": {
17+
"number_of_shards": "1"
18+
}
19+
},
20+
"mappings": {
1721
"_source": {
1822
"enabled": false
1923
},

examples/resources/opensearch_component_template/resource.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resource "opensearch_component_template" "test" {
55
"template": {
66
"settings": {
77
"index": {
8-
"number_of_shards": 1
8+
"number_of_shards": "1"
99
}
1010
},
1111
"mappings": {

examples/resources/opensearch_composable_index_template/resource.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resource "opensearch_composable_index_template" "template_1" {
66
"template": {
77
"settings": {
88
"index": {
9-
"number_of_shards": 1
9+
"number_of_shards": "1"
1010
}
1111
},
1212
"mappings": {

examples/resources/opensearch_index/resource.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Create a simple index
2-
resource "opensearch_index" "test" {
2+
resource "opensearch_index" "test-simple-index" {
33
name = "terraform-test"
4-
number_of_shards = 1
5-
number_of_replicas = 1
4+
number_of_shards = "1"
5+
number_of_replicas = "1"
66
mappings = <<EOF
77
{
88
"properties": {

examples/resources/opensearch_index_template/resource.tf

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ resource "opensearch_index_template" "template_1" {
1010
"aliases": {
1111
"my_logs": {}
1212
},
13+
"settings": {
14+
"number_of_shards": "2",
15+
"number_of_replicas": "1"
16+
},
1317
"mappings": {
1418
"properties": {
1519
"timestamp": {

provider/provider.go

+20-20
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030

3131
type ServerFlavor int64
3232

33-
// opensearch
33+
// OpenSearch
3434
const (
3535
Unknown ServerFlavor = iota
3636
OpenSearch
@@ -78,31 +78,31 @@ func Provider() *schema.Provider {
7878
Type: schema.TypeString,
7979
Required: true,
8080
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_URL", nil),
81-
Description: "Opensearch URL",
81+
Description: "OpenSearch URL",
8282
},
8383
"sniff": {
8484
Type: schema.TypeBool,
8585
Optional: true,
8686
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_SNIFF", false),
87-
Description: "Set the node sniffing option for the opensearch client. Client won't work with sniffing if nodes are not routable.",
87+
Description: "Set the node sniffing option for the OpenSearch client. Client won't work with sniffing if nodes are not routable.",
8888
},
8989
"healthcheck": {
9090
Type: schema.TypeBool,
9191
Optional: true,
9292
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_HEALTH", true),
93-
Description: "Set the client healthcheck option for the opensearch client. Healthchecking is designed for direct access to the cluster.",
93+
Description: "Set the client healthcheck option for the OpenSearch client. Healthchecking is designed for direct access to the cluster.",
9494
},
9595
"username": {
9696
Type: schema.TypeString,
9797
Optional: true,
9898
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_USERNAME", nil),
99-
Description: "Username to use to connect to opensearch using basic auth",
99+
Description: "Username to use to connect to OpenSearch using basic auth",
100100
},
101101
"password": {
102102
Type: schema.TypeString,
103103
Optional: true,
104104
DefaultFunc: schema.EnvDefaultFunc("OPENSEARCH_PASSWORD", nil),
105-
Description: "Password to use to connect to opensearch using basic auth",
105+
Description: "Password to use to connect to OpenSearch using basic auth",
106106
},
107107
"token": {
108108
Type: schema.TypeString,
@@ -132,31 +132,31 @@ func Provider() *schema.Provider {
132132
Type: schema.TypeString,
133133
Optional: true,
134134
Default: "",
135-
Description: "The access key for use with AWS opensearch Service domains",
135+
Description: "The access key for use with AWS OpenSearch Service domains",
136136
},
137137
"aws_secret_key": {
138138
Type: schema.TypeString,
139139
Optional: true,
140140
Default: "",
141-
Description: "The secret key for use with AWS opensearch Service domains",
141+
Description: "The secret key for use with AWS OpenSearch Service domains",
142142
},
143143
"aws_token": {
144144
Type: schema.TypeString,
145145
Optional: true,
146146
Default: "",
147-
Description: "The session token for use with AWS opensearch Service domains",
147+
Description: "The session token for use with AWS OpenSearch Service domains",
148148
},
149149
"aws_profile": {
150150
Type: schema.TypeString,
151151
Optional: true,
152152
Default: "",
153-
Description: "The AWS profile for use with AWS opensearch Service domains",
153+
Description: "The AWS profile for use with AWS OpenSearch Service domains",
154154
},
155155
"aws_region": {
156156
Type: schema.TypeString,
157157
Optional: true,
158158
Default: "",
159-
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.",
159+
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.",
160160
},
161161
"cacert_file": {
162162
Type: schema.TypeString,
@@ -174,36 +174,36 @@ func Provider() *schema.Provider {
174174
Type: schema.TypeString,
175175
Optional: true,
176176
Default: "",
177-
Description: "A X509 certificate to connect to opensearch",
177+
Description: "A X509 certificate to connect to OpenSearch",
178178
DefaultFunc: schema.EnvDefaultFunc("OS_CLIENT_CERTIFICATE_PATH", ""),
179179
},
180180
"client_key_path": {
181181
Type: schema.TypeString,
182182
Optional: true,
183183
Default: "",
184-
Description: "A X509 key to connect to opensearch",
184+
Description: "A X509 key to connect to OpenSearch",
185185
DefaultFunc: schema.EnvDefaultFunc("OS_CLIENT_KEY_PATH", ""),
186186
},
187187
"sign_aws_requests": {
188188
Type: schema.TypeBool,
189189
Optional: true,
190190
Default: true,
191-
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.",
191+
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.",
192192
},
193193
"aws_signature_service": {
194194
Type: schema.TypeString,
195195
Optional: true,
196196
Default: "es",
197-
Description: "AWS service name used in the credential scope of signed requests to opensearch.",
197+
Description: "AWS service name used in the credential scope of signed requests to OpenSearch.",
198198
},
199199
"opensearch_version": {
200200
Type: schema.TypeString,
201201
Optional: true,
202202
Default: "",
203-
Description: "opensearch Version",
203+
Description: "OpenSearch Version",
204204
},
205205
// version_ping_timeout is the time the ping to check the cluster
206-
// version waits for a response from opensearch on startup, e.g. when
206+
// version waits for a response from OpenSearch on startup, e.g. when
207207
// creating a provider.
208208
"version_ping_timeout": {
209209
Type: schema.TypeInt,
@@ -215,12 +215,12 @@ func Provider() *schema.Provider {
215215
Type: schema.TypeString,
216216
Optional: true,
217217
Default: "",
218-
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.",
218+
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.",
219219
},
220220
"proxy": {
221221
Type: schema.TypeString,
222222
Optional: true,
223-
Description: "Proxy URL to use for requests to opensearch.",
223+
Description: "Proxy URL to use for requests to OpenSearch.",
224224
},
225225
},
226226

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

427427
return client, nil

provider/resource_opensearch_index_template.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
func resourceOpensearchIndexTemplate() *schema.Resource {
1515
return &schema.Resource{
16-
Description: "Provides an Opensearch index template resource.",
16+
Description: "Provides an OpenSearch index template resource.",
1717
Create: resourceOpensearchIndexTemplateCreate,
1818
Read: resourceOpensearchIndexTemplateRead,
1919
Update: resourceOpensearchIndexTemplateUpdate,

provider/resource_opensearch_ism_policy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func resourceOpensearchISMPolicyRead(d *schema.ResourceData, m interface{}) erro
7979

8080
if err != nil {
8181
if elastic6.IsNotFound(err) || elastic7.IsNotFound(err) {
82-
log.Printf("[WARN] Opensearch Policy (%s) not found, removing from state", d.Id())
82+
log.Printf("[WARN] OpenSearch Policy (%s) not found, removing from state", d.Id())
8383
d.SetId("")
8484
return nil
8585
}

provider/resource_opensearch_ism_policy_mapping.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var openDistroISMPolicyMappingSchema = map[string]*schema.Schema{
5353

5454
func resourceOpenSearchISMPolicyMapping() *schema.Resource {
5555
return &schema.Resource{
56-
Description: "Provides an OpenSearch Index State Management (ISM) policy. Please refer to the OpenSearch ISM documentation for details.",
56+
Description: "Provides an OpenSearch Index State Management (ISM) policy. Please refer to the OpenSearch ISM documentation for details.\n\n!> `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.",
5757
Create: resourceOpensearchOpenDistroISMPolicyMappingCreate,
5858
Read: resourceOpensearchOpenDistroISMPolicyMappingRead,
5959
Update: resourceOpensearchOpenDistroISMPolicyMappingUpdate,
@@ -66,7 +66,7 @@ func resourceOpenSearchISMPolicyMapping() *schema.Resource {
6666
Create: schema.DefaultTimeout(5 * time.Minute),
6767
Update: schema.DefaultTimeout(5 * time.Minute),
6868
},
69-
DeprecationMessage: "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.",
69+
DeprecationMessage: "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.",
7070
}
7171
}
7272

provider/resource_opensearch_sm_policy_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestAccOpensearchSMPolicy(t *testing.T) {
2424
testAccPreCheck(t)
2525

2626
if !allowed {
27-
t.Skip("OpenSearch Snapshot Management only supported on Opensearch >= 2.1")
27+
t.Skip("OpenSearch Snapshot Management only supported on OpenSearch >= 2.1")
2828
}
2929
},
3030
Providers: testAccOpendistroProviders,

0 commit comments

Comments
 (0)