Skip to content

Commit e6c84b7

Browse files
Lexsssxiaozhu36
authored andcommitted
improve(elasticsearch): added terratest for this module.
1 parent 47f5a19 commit e6c84b7

File tree

2,018 files changed

+597415
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,018 files changed

+597415
-2
lines changed

outputs.tf

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,61 @@
1-
output "elasticsearch_ids" {
2-
value = join(",", alicloud_elasticsearch_instance.instance.*.id)
1+
output "this_elasticsearch_ids" {
2+
value = alicloud_elasticsearch_instance.instance.*.id
3+
}
4+
5+
output "this_instance_charge_type" {
6+
value = alicloud_elasticsearch_instance.instance.*.instance_charge_type[0]
7+
}
8+
9+
output "this_period" {
10+
value = alicloud_elasticsearch_instance.instance.*.period[0]
11+
12+
}
13+
14+
output "this_data_node_spec" {
15+
value = alicloud_elasticsearch_instance.instance.*.data_node_spec[0]
16+
}
17+
18+
output "this_data_node_amount" {
19+
value = alicloud_elasticsearch_instance.instance.*.data_node_amount[0]
20+
}
21+
22+
output "this_data_node_disk_size" {
23+
value = alicloud_elasticsearch_instance.instance.*.data_node_disk_size[0]
24+
}
25+
26+
output "this_data_node_disk_type" {
27+
value = alicloud_elasticsearch_instance.instance.*.data_node_disk_type[0]
28+
}
29+
30+
output "this_es_version" {
31+
value = alicloud_elasticsearch_instance.instance.*.version[0]
32+
}
33+
34+
output "this_vswitch_id" {
35+
value = alicloud_elasticsearch_instance.instance.*.vswitch_id[0]
36+
}
37+
38+
output "this_password" {
39+
value = alicloud_elasticsearch_instance.instance.*.password[0]
40+
}
41+
42+
output "this_private_whitelist" {
43+
value = alicloud_elasticsearch_instance.instance.*.private_whitelist[0]
44+
}
45+
46+
output "this_kibana_whitelist" {
47+
value = alicloud_elasticsearch_instance.instance.*.kibana_whitelist[0]
48+
}
49+
50+
output "this_master_node_spec" {
51+
value = alicloud_elasticsearch_instance.instance.*.master_node_spec[0]
52+
}
53+
54+
output "this_description" {
55+
value = alicloud_elasticsearch_instance.instance.*.description[0]
56+
}
57+
58+
output "number_of_instance" {
59+
value = length(alicloud_elasticsearch_instance.instance.*.id)
360
}
461

terratest/Gopkg.lock

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terratest/Gopkg.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[constraint]]
2+
name = "github.com/gruntwork-io/terratest"
3+
version = "0.17.4"

terratest/basic/main.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module "vpc" {
2+
//source = "alibaba/vpc/alicloud"
3+
source = "alibaba/vpc/alicloud"
4+
5+
vpc_name = "my_terratest_vpc"
6+
7+
vswitch_name = "my_terratest_vswitch"
8+
vswitch_cidrs = [
9+
"172.16.1.0/24"
10+
]
11+
}
12+
13+
module "elasticsearch" {
14+
source = "../../"
15+
period = var.period
16+
password = var.password
17+
private_whitelist = var.private_whitelist
18+
kibana_whitelist = var.kibana_whitelist
19+
description = var.description
20+
number_of_instance = var.number_of_instance
21+
data_node_spec = var.data_node_spec
22+
data_node_amount = var.data_node_amount
23+
data_node_disk_size = var.data_node_disk_size
24+
data_node_disk_type = var.data_node_disk_type
25+
es_version = var.es_version
26+
vswitch_id = var.vswitch_id == "" ? module.vpc.vswitch_ids[0] : var.vswitch_id
27+
master_node_spec = var.master_node_spec
28+
}
29+

terratest/basic/outputs.tf

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
output "this_elasticsearch_ids" {
3+
value = module.elasticsearch.this_elasticsearch_ids
4+
}
5+
6+
output "this_instance_charge_type" {
7+
value = module.elasticsearch.this_instance_charge_type
8+
}
9+
10+
output "this_period" {
11+
value = module.elasticsearch.this_period
12+
13+
}
14+
15+
output "this_data_node_spec" {
16+
value = module.elasticsearch.this_data_node_spec
17+
}
18+
19+
output "this_data_node_amount" {
20+
value = module.elasticsearch.this_data_node_amount
21+
}
22+
23+
output "this_data_node_disk_size" {
24+
value = module.elasticsearch.this_data_node_disk_size
25+
}
26+
27+
output "this_data_node_disk_type" {
28+
value = module.elasticsearch.this_data_node_disk_type
29+
}
30+
31+
output "this_es_version" {
32+
value = module.elasticsearch.this_es_version
33+
}
34+
35+
output "this_vswitch_id" {
36+
value = module.elasticsearch.this_vswitch_id
37+
}
38+
39+
output "this_password" {
40+
value = module.elasticsearch.this_password
41+
}
42+
43+
output "this_private_whitelist" {
44+
value = module.elasticsearch.this_private_whitelist
45+
}
46+
47+
output "this_kibana_whitelist" {
48+
value = module.elasticsearch.this_kibana_whitelist
49+
}
50+
51+
output "this_master_node_spec" {
52+
value = module.elasticsearch.this_master_node_spec
53+
}
54+
55+
output "this_description" {
56+
value = module.elasticsearch.this_description
57+
}
58+
59+
output "number_of_instance" {
60+
value = module.elasticsearch.number_of_instance
61+
}
62+

terratest/basic/variables.tf

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
variable "instance_charge_type" {
2+
default = "PostPaid"
3+
}
4+
5+
variable "period" {
6+
default = "1"
7+
}
8+
9+
variable "data_node_spec" {
10+
description = "The data node specifications of the Elasticsearch instance."
11+
}
12+
13+
variable "data_node_amount" {
14+
description = "The Elasticsearch cluster's data node quantity, between 2 and 50."
15+
}
16+
17+
variable "data_node_disk_size" {
18+
description = "The single data node storage space."
19+
}
20+
21+
variable "data_node_disk_type" {
22+
description = "The data node disk type. Supported values: cloud_ssd, cloud_efficiency."
23+
}
24+
25+
variable "es_version" {
26+
description = "Elasticsearch version. Supported values: 5.5.3_with_X-Pack and 6.3_with_X-Pack."
27+
}
28+
29+
variable "vswitch_id" {
30+
description = "The ID of VSwitch."
31+
default = ""
32+
}
33+
34+
variable "password" {
35+
description = "The password of the instance."
36+
}
37+
38+
variable "private_whitelist" {
39+
type = list(string)
40+
default = ["0.0.0.0/0"]
41+
}
42+
43+
variable "kibana_whitelist" {
44+
type = list(string)
45+
default = ["0.0.0.0/0"]
46+
}
47+
48+
variable "master_node_spec" {
49+
default = ""
50+
}
51+
52+
variable "description" {
53+
default = ""
54+
}
55+
56+
variable "number_of_instance" {
57+
default = 1
58+
}
59+

0 commit comments

Comments
 (0)