Skip to content

Commit e723d10

Browse files
MrWolongxiaozhu36
authored andcommitted
Improves the module examples/complete
1 parent ab4f598 commit e723d10

File tree

2,029 files changed

+246
-597108
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,029 files changed

+246
-597108
lines changed

.gitignore

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
# Local .terraform directories
2-
**/.terraform/*
3-
4-
# .tfstate files
1+
# Compiled files
52
*.tfstate
6-
*.tfstate.*
3+
*.tfstate.backup
4+
*.terraform.*
5+
6+
# Module directory
7+
.terraform/
8+
9+
# terraform log
10+
*.log
11+
12+
# auto-generated key pair file
13+
*.pem
14+
15+
# tools files
16+
.DS_Store
17+
.idea
718

8-
# .tfvars files
9-
*.tfvars
19+
# others
20+
*.bak
21+
*.bk
22+
.terraform.lock.hcl
23+
.terraform.tfstate.lock.info
24+
*/vendor

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ More details see [How to use provider in the module](https://www.terraform.io/do
123123

124124
| Name | Version |
125125
|------|---------|
126-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.0 |
126+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
127127
| <a name="requirement_alicloud"></a> [alicloud](#requirement\_alicloud) | >= 1.56.0 |
128128

129129
Authors

example/main.tf

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/outputs.tf

Lines changed: 0 additions & 4 deletions
This file was deleted.

example/versions.tf

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/complete/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Complete
2+
3+
Configuration in this directory creates ElasticSearch Instances.
4+
5+
## Usage
6+
7+
To run this example you need to execute:
8+
9+
```bash
10+
$ terraform init
11+
$ terraform plan
12+
$ terraform apply
13+
```
14+
15+
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
16+
17+
This example provides the tf variables file in the folder `tfvars`. If you want to create or update this example,
18+
you can run this example as the following commands:
19+
```bash
20+
$ terraform plan -var-file=tfvars/01-update.tfvars
21+
$ terraform apply -var-file=tfvars/01-update.tfvars
22+
```
23+
24+
Also, you can add more variables files in the folder `tfvars`.
25+
26+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
27+
## Requirements
28+
29+
| Name | Version |
30+
|------|---------|
31+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
32+
| <a name="requirement_alicloud"></a> [alicloud](#requirement\_alicloud) | >= 1.56.0 |

examples/complete/main.tf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
data "alicloud_elasticsearch_zones" "default" {
2+
}
3+
4+
module "vpc" {
5+
source = "alibaba/vpc/alicloud"
6+
create = true
7+
vpc_cidr = "172.16.0.0/16"
8+
vswitch_cidrs = ["172.16.0.0/21"]
9+
availability_zones = [data.alicloud_elasticsearch_zones.default.zones.0.id]
10+
}
11+
12+
module "example" {
13+
source = "../.."
14+
15+
number_of_instance = 1
16+
17+
instance_charge_type = var.instance_charge_type
18+
period = var.period
19+
data_node_amount = var.data_node_amount
20+
data_node_spec = var.data_node_spec
21+
data_node_disk_size = var.data_node_disk_size
22+
data_node_disk_type = var.data_node_disk_type
23+
vswitch_id = module.vpc.this_vswitch_ids[0]
24+
password = var.password
25+
es_version = "5.5.3_with_X-Pack"
26+
private_whitelist = var.private_whitelist
27+
kibana_whitelist = var.kibana_whitelist
28+
master_node_spec = var.master_node_spec
29+
description = var.description
30+
31+
}

examples/complete/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "elasticsearch_ids" {
2+
value = module.example.this_elasticsearch_ids
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#alicloud_elasticsearch_instance
2+
period = 2
3+
data_node_amount = 3
4+
data_node_spec = "elasticsearch.sn2ne.large"
5+
data_node_disk_size = 30
6+
data_node_disk_type = "cloud_ssd"
7+
password = "YourPassword123!Update"
8+
private_whitelist = ["172.16.0.0/21"]
9+
kibana_whitelist = ["172.16.0.0/21"]
10+
master_node_spec = "elasticsearch.sn2ne.xlarge"
11+
description = "update-tf-description"

examples/complete/variables.tf

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
variable "instance_charge_type" {
2+
description = "Valid values are PrePaid, PostPaid. Default to PostPaid"
3+
type = string
4+
default = "PostPaid"
5+
}
6+
7+
variable "period" {
8+
description = "The duration that you will buy Elasticsearch instance (in month). It is valid when instance_charge_type is PrePaid. Valid values: [1~9], 12, 24, 36."
9+
type = number
10+
default = 1
11+
}
12+
13+
variable "data_node_amount" {
14+
description = "The Elasticsearch cluster's data node quantity, between 2 and 50."
15+
type = number
16+
default = 2
17+
}
18+
19+
variable "data_node_spec" {
20+
description = "The data node specifications of the Elasticsearch instance."
21+
type = string
22+
default = "elasticsearch.sn1ne.large"
23+
}
24+
25+
variable "data_node_disk_size" {
26+
description = "The single data node storage space."
27+
type = number
28+
default = 20
29+
}
30+
31+
variable "data_node_disk_type" {
32+
description = "The data node disk type. Supported values: cloud_ssd, cloud_efficiency."
33+
type = string
34+
default = "cloud_efficiency"
35+
}
36+
37+
variable "password" {
38+
description = "The password of the instance."
39+
type = string
40+
default = "YourPassword123!"
41+
}
42+
43+
variable "private_whitelist" {
44+
description = "Set the instance's IP whitelist in VPC network."
45+
type = list(string)
46+
default = ["0.0.0.0/0"]
47+
}
48+
49+
variable "kibana_whitelist" {
50+
description = "Set the Kibana's IP whitelist in internet network."
51+
type = list(string)
52+
default = ["0.0.0.0/0"]
53+
}
54+
55+
variable "master_node_spec" {
56+
description = "The master node specifications of the Elasticsearch instance."
57+
type = string
58+
default = "elasticsearch.sn2ne.large"
59+
}
60+
61+
variable "description" {
62+
description = "The description of the Elasticsearch instance."
63+
type = string
64+
default = "tf-description"
65+
}

0 commit comments

Comments
 (0)