Skip to content

Commit 2ef4d8a

Browse files
lexwonglexwong
authored andcommitted
imporve(elasticsearch): update the module to the format of the new version.
1 parent c1bdc80 commit 2ef4d8a

File tree

7 files changed

+42
-18
lines changed

7 files changed

+42
-18
lines changed

example/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ module "instance" {
99
vswitch_id = "vswitch id"
1010
master_node_spec = "elasticsearch.sn2ne.large"
1111
}
12+

example/outputs.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
output "elasticsearch_ids" {
2-
value = "${module.instance.elasticsearch_ids}"
2+
value = module.instance.elasticsearch_ids
33
}
4+

example/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
terraform {
3+
required_version = ">= 0.12"
4+
}

main.tf

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1+
provider "alicloud" {
2+
version = ">=1.56.0"
3+
region = var.region != "" ? var.region : null
4+
configuration_source = "terraform-alicloud-modules/elasticsearch-instance"
5+
}
6+
17
#########################
28
# Elasticsearch instance
39
#########################
410

511
resource "alicloud_elasticsearch_instance" "instance" {
6-
instance_charge_type = "${var.instance_charge_type}"
7-
data_node_amount = "${var.data_node_amount}"
8-
data_node_spec = "${var.data_node_spec}"
9-
data_node_disk_size = "${var.data_node_disk_size}"
10-
data_node_disk_type = "${var.data_node_disk_type}"
11-
vswitch_id = "${var.vswitch_id}"
12-
password = "${var.password}"
13-
version = "${var.es_version}"
14-
count = "${var.number_of_instance}"
15-
private_whitelist = "${var.private_whitelist}"
16-
kibana_whitelist = "${var.kibana_whitelist}"
17-
description = "${var.description}"
18-
master_node_spec = "${var.master_node_spec}"
19-
period = "${var.period}"
12+
instance_charge_type = var.instance_charge_type
13+
data_node_amount = var.data_node_amount
14+
data_node_spec = var.data_node_spec
15+
data_node_disk_size = var.data_node_disk_size
16+
data_node_disk_type = var.data_node_disk_type
17+
vswitch_id = var.vswitch_id
18+
password = var.password
19+
version = var.es_version
20+
count = var.number_of_instance
21+
private_whitelist = var.private_whitelist
22+
kibana_whitelist = var.kibana_whitelist
23+
description = var.description
24+
master_node_spec = var.master_node_spec
25+
period = var.period
2026
}
27+

outputs.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
output "elasticsearch_ids" {
2-
value = "${join(",", alicloud_elasticsearch_instance.instance.*.id)}"
2+
value = join(",", alicloud_elasticsearch_instance.instance.*.id)
33
}
4+

variables.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
variable "region" {
2+
description = "The region used to launch this module resources."
3+
default = ""
4+
}
5+
16
variable "instance_charge_type" {
27
description = "Valid values are PrePaid, PostPaid. Default to PostPaid"
38
default = "PostPaid"
@@ -37,13 +42,13 @@ variable "password" {
3742
}
3843

3944
variable "private_whitelist" {
40-
type = "list"
45+
type = list(string)
4146
description = "Set the instance's IP whitelist in VPC network."
4247
default = ["0.0.0.0/0"]
4348
}
4449

4550
variable "kibana_whitelist" {
46-
type = "list"
51+
type = list(string)
4752
description = "Set the Kibana's IP whitelist in internet network."
4853
default = ["0.0.0.0/0"]
4954
}
@@ -62,3 +67,4 @@ variable "number_of_instance" {
6267
description = "Instance count"
6368
default = 1
6469
}
70+

versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
terraform {
3+
required_version = ">= 0.12"
4+
}

0 commit comments

Comments
 (0)