Skip to content

Commit

Permalink
Merge branch 'feat/tls-index' into 'master'
Browse files Browse the repository at this point in the history
feat: 更新 tls index 资源 [skipped]

See merge request iaasng/terraform-provider-volcengine!519
  • Loading branch information
msq177 committed Jun 24, 2024
2 parents e5912ec + 12e31fe commit 46fa6f6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.146"
TerraformProviderVersion = "0.0.147"
)
5 changes: 3 additions & 2 deletions example/tlsIndex/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "volcengine_tls_index" "foo" {
topic_id = "7ce12237-6670-44a7-9d79-2e36961586e6"
topic_id = "227a8d0c-b85b-48df-bee1-0927a595****"

# full_text {
# case_sensitive = true
Expand All @@ -13,7 +13,8 @@ resource "volcengine_tls_index" "foo" {
case_sensitive = true
delimiter = "!"
include_chinese = false
sql_flag = false
sql_flag = true
index_all = true
json_keys {
key = "class"
value_type = "text"
Expand Down
5 changes: 5 additions & 0 deletions volcengine/tls/index/data_source_volcengine_tls_indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ func DataSourceVolcengineTlsIndexes() *schema.Resource {
Computed: true,
Description: "Whether the filed is enabled for analysis.",
},
"index_all": {
Type: schema.TypeBool,
Computed: true,
Description: "Whether to create indexes for all fields in JSON fields with text values.",
},
"json_keys": {
Type: schema.TypeList,
Computed: true,
Expand Down
6 changes: 6 additions & 0 deletions volcengine/tls/index/resource_volcengine_tls_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ func ResourceVolcengineTlsIndex() *schema.Resource {
Default: false,
Description: "Whether the filed is enabled for analysis.",
},
"index_all": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "Whether to create indexes for all fields in JSON fields with text values. This field is valid when the `value_type` is `json`.",
},
"json_keys": {
Type: schema.TypeSet,
Optional: true,
Expand Down
6 changes: 6 additions & 0 deletions volcengine/tls/index/service_volcengine_tls_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ func transKeyValueToRequest(keyValueSet interface{}) ([]interface{}, error) {
}
keyValue["Key"] = kMap["key"]
valueMap["ValueType"] = kMap["value_type"]
sqlFlag := false
if v, ok := kMap["case_sensitive"]; ok {
valueMap["CaseSensitive"] = v
}
Expand All @@ -339,8 +340,12 @@ func transKeyValueToRequest(keyValueSet interface{}) ([]interface{}, error) {
if v, ok := kMap["delimiter"]; ok {
valueMap["Delimiter"] = v
}
if v, ok := kMap["index_all"]; ok {
valueMap["IndexAll"] = v
}
if v, ok := kMap["sql_flag"]; ok {
valueMap["SqlFlag"] = v
sqlFlag = v.(bool)
}
if v, ok := kMap["json_keys"]; ok {
jsonKeys := make([]interface{}, 0)
Expand All @@ -360,6 +365,7 @@ func transKeyValueToRequest(keyValueSet interface{}) ([]interface{}, error) {
if v, ok = keyMap["value_type"]; ok {
jsonValue := make(map[string]interface{})
jsonValue["ValueType"] = v
jsonValue["SqlFlag"] = sqlFlag
jsonKey["Value"] = jsonValue
}
jsonKeys = append(jsonKeys, jsonKey)
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/tls_indexes.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ In addition to all arguments above, the following attributes are exported:
* `case_sensitive` - Whether the value is case sensitive.
* `delimiter` - The delimiter of the value.
* `include_chinese` - Whether the value include chinese.
* `index_all` - Whether to create indexes for all fields in JSON fields with text values.
* `json_keys` - The JSON subfield key value index.
* `case_sensitive` - Whether the value is case sensitive.
* `delimiter` - The delimiter of the value.
Expand Down
6 changes: 4 additions & 2 deletions website/docs/r/tls_index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Provides a resource to manage tls index
## Example Usage
```hcl
resource "volcengine_tls_index" "foo" {
topic_id = "7ce12237-6670-44a7-9d79-2e36961586e6"
topic_id = "227a8d0c-b85b-48df-bee1-0927a595****"
# full_text {
# case_sensitive = true
Expand All @@ -25,7 +25,8 @@ resource "volcengine_tls_index" "foo" {
case_sensitive = true
delimiter = "!"
include_chinese = false
sql_flag = false
sql_flag = true
index_all = true
json_keys {
key = "class"
value_type = "text"
Expand Down Expand Up @@ -88,6 +89,7 @@ The `key_value` object supports the following:
* `case_sensitive` - (Optional) Whether the value is case sensitive.
* `delimiter` - (Optional) The delimiter of the value.
* `include_chinese` - (Optional) Whether the value include chinese.
* `index_all` - (Optional) Whether to create indexes for all fields in JSON fields with text values. This field is valid when the `value_type` is `json`.
* `json_keys` - (Optional) The JSON subfield key value index.
* `sql_flag` - (Optional) Whether the filed is enabled for analysis.

Expand Down

0 comments on commit 46fa6f6

Please sign in to comment.