Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ module "instance" {
vswitch_id = "vswitch id"
master_node_spec = "elasticsearch.sn2ne.large"
}

3 changes: 2 additions & 1 deletion example/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "elasticsearch_ids" {
value = "${module.instance.elasticsearch_ids}"
value = module.instance.elasticsearch_ids
}

4 changes: 4 additions & 0 deletions example/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
35 changes: 21 additions & 14 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
provider "alicloud" {
version = ">=1.56.0"
region = var.region != "" ? var.region : null
configuration_source = "terraform-alicloud-modules/elasticsearch-instance"
}

#########################
# Elasticsearch instance
#########################

resource "alicloud_elasticsearch_instance" "instance" {
instance_charge_type = "${var.instance_charge_type}"
data_node_amount = "${var.data_node_amount}"
data_node_spec = "${var.data_node_spec}"
data_node_disk_size = "${var.data_node_disk_size}"
data_node_disk_type = "${var.data_node_disk_type}"
vswitch_id = "${var.vswitch_id}"
password = "${var.password}"
version = "${var.es_version}"
count = "${var.number_of_instance}"
private_whitelist = "${var.private_whitelist}"
kibana_whitelist = "${var.kibana_whitelist}"
description = "${var.description}"
master_node_spec = "${var.master_node_spec}"
period = "${var.period}"
instance_charge_type = var.instance_charge_type
data_node_amount = var.data_node_amount
data_node_spec = var.data_node_spec
data_node_disk_size = var.data_node_disk_size
data_node_disk_type = var.data_node_disk_type
vswitch_id = var.vswitch_id
password = var.password
version = var.es_version
count = var.number_of_instance
private_whitelist = var.private_whitelist
kibana_whitelist = var.kibana_whitelist
description = var.description
master_node_spec = var.master_node_spec
period = var.period
}

3 changes: 2 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
output "elasticsearch_ids" {
value = "${join(",", alicloud_elasticsearch_instance.instance.*.id)}"
value = join(",", alicloud_elasticsearch_instance.instance.*.id)
}

10 changes: 8 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
variable "region" {
description = "The region used to launch this module resources."
default = ""
}

variable "instance_charge_type" {
description = "Valid values are PrePaid, PostPaid. Default to PostPaid"
default = "PostPaid"
Expand Down Expand Up @@ -37,13 +42,13 @@ variable "password" {
}

variable "private_whitelist" {
type = "list"
type = list(string)
description = "Set the instance's IP whitelist in VPC network."
default = ["0.0.0.0/0"]
}

variable "kibana_whitelist" {
type = "list"
type = list(string)
description = "Set the Kibana's IP whitelist in internet network."
default = ["0.0.0.0/0"]
}
Expand All @@ -62,3 +67,4 @@ variable "number_of_instance" {
description = "Instance count"
default = 1
}

4 changes: 4 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}