Skip to content

Commit 678cb1f

Browse files
authored
es import with default value (#1655)
* es import with default value * es import with default value
1 parent e934ceb commit 678cb1f

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.changelog/1655.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_elasticsearch_instance: set `basic_security_type` default 1 when import instance
3+
```

tencentcloud/extension_elasticsearch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var ES_DEPLOY_MODE = []int{
4242
var ES_LICENSE_TYPE = []string{
4343
ES_LICENSE_TYPE_BASIC,
4444
ES_LICENSE_TYPE_PLATINUM,
45+
ES_LICENSE_TYPE_OSS,
4546
}
4647

4748
var ES_BASIC_SECURITY_TYPE = []int{

tencentcloud/resource_tc_elasticsearch_instance.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ func resourceTencentCloudElasticsearchInstance() *schema.Resource {
7171
Update: resourceTencentCloudElasticsearchInstanceUpdate,
7272
Delete: resourceTencentCloudElasticsearchInstanceDelete,
7373
Importer: &schema.ResourceImporter{
74-
State: schema.ImportStatePassthrough,
74+
State: helper.ImportWithDefaultValue(map[string]interface{}{
75+
"basic_security_type": ES_BASIC_SECURITY_TYPE_OFF,
76+
}),
7577
},
7678

7779
Schema: map[string]*schema.Schema{
@@ -214,7 +216,7 @@ func resourceTencentCloudElasticsearchInstance() *schema.Resource {
214216
Optional: true,
215217
Default: ES_LICENSE_TYPE_PLATINUM,
216218
ValidateFunc: validateAllowedStringValue(ES_LICENSE_TYPE),
217-
Description: "License type. Valid values are `basic` and `platinum`. The default value is `platinum`.",
219+
Description: "License type. Valid values are `oss`, `basic` and `platinum`. The default value is `platinum`.",
218220
},
219221
"node_info_list": {
220222
Type: schema.TypeList,
@@ -267,7 +269,7 @@ func resourceTencentCloudElasticsearchInstance() *schema.Resource {
267269
Optional: true,
268270
Default: ES_BASIC_SECURITY_TYPE_OFF,
269271
ValidateFunc: validateAllowedIntValue(ES_BASIC_SECURITY_TYPE),
270-
Description: "Whether to enable X-Pack security authentication in Basic Edition 6.8 and above. Valid values are `1` and `2`. `1` is disabled, `2` is enabled, and default value is `1`. Notice: this parameter is only for `basic edition.",
272+
Description: "Whether to enable X-Pack security authentication in Basic Edition 6.8 and above. Valid values are `1` and `2`. `1` is disabled, `2` is enabled, and default value is `1`. Notice: this parameter is only take effect on `basic` license.",
271273
},
272274
"tags": {
273275
Type: schema.TypeMap,

website/docs/r/elasticsearch_instance.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ The following arguments are supported:
5959
* `version` - (Required, String) Version of the instance. Valid values are `5.6.4`, `6.4.3`, `6.8.2` and `7.5.1`.
6060
* `vpc_id` - (Required, String, ForceNew) The ID of a VPC network.
6161
* `availability_zone` - (Optional, String, ForceNew) Availability zone. When create multi-az es, this parameter must be omitted.
62-
* `basic_security_type` - (Optional, Int) Whether to enable X-Pack security authentication in Basic Edition 6.8 and above. Valid values are `1` and `2`. `1` is disabled, `2` is enabled, and default value is `1`. Notice: this parameter is only for `basic edition.
62+
* `basic_security_type` - (Optional, Int) Whether to enable X-Pack security authentication in Basic Edition 6.8 and above. Valid values are `1` and `2`. `1` is disabled, `2` is enabled, and default value is `1`. Notice: this parameter is only take effect on `basic` license.
6363
* `charge_period` - (Optional, Int, ForceNew) The tenancy of the prepaid instance, and uint is month. NOTE: it only works when charge_type is set to `PREPAID`.
6464
* `charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`.
6565
* `deploy_mode` - (Optional, Int, ForceNew) Cluster deployment mode. Valid values are `0` and `1`. `0` is single-AZ deployment, and `1` is multi-AZ deployment. Default value is `0`.
6666
* `es_acl` - (Optional, List) Kibana Access Control Configuration.
6767
* `instance_name` - (Optional, String) Name of the instance, which can contain 1 to 50 English letters, Chinese characters, digits, dashes(-), or underscores(_).
68-
* `license_type` - (Optional, String) License type. Valid values are `basic` and `platinum`. The default value is `platinum`.
68+
* `license_type` - (Optional, String) License type. Valid values are `oss`, `basic` and `platinum`. The default value is `platinum`.
6969
* `multi_zone_infos` - (Optional, List, ForceNew) Details of AZs in multi-AZ deployment mode (which is required when deploy_mode is `1`).
7070
* `renew_flag` - (Optional, String, ForceNew) When enabled, the instance will be renew automatically when it reach the end of the prepaid tenancy. Valid values are `RENEW_FLAG_AUTO` and `RENEW_FLAG_MANUAL`. NOTE: it only works when charge_type is set to `PREPAID`.
7171
* `subnet_id` - (Optional, String, ForceNew) The ID of a VPC subnetwork. When create multi-az es, this parameter must be omitted.

0 commit comments

Comments
 (0)