|
1 |
| -# terraform-alicloud-mongodb |
2 |
| - |
3 | 1 | Terraform module which creates MongoDB instance on Alibaba Cloud
|
4 | 2 |
|
5 |
| -## mongodb replica instance |
| 3 | +terraform-alicloud-mongodb |
| 4 | +===================================================================== |
| 5 | + |
| 6 | +English | [简体中文](https://github.com/terraform-alicloud-modules/terraform-alicloud-mongodb/blob/master/README-cn.md) |
6 | 7 |
|
7 | 8 | Terraform module which creates MongoDB replica instance resources on Alibaba Cloud
|
8 | 9 |
|
9 | 10 | These types of resources are supported:
|
10 | 11 |
|
11 |
| -- [mongodb_instance] (https://www.terraform.io/docs/providers/alicloud/r/mongodb_instance.html) |
| 12 | +* [Alicloud_mongodb_instance](https://www.terraform.io/docs/providers/alicloud/r/mongodb_instance.html) |
12 | 13 |
|
13 |
| -## Usage |
| 14 | +---------------------- |
| 15 | + |
| 16 | +## Terraform versions |
14 | 17 |
|
| 18 | +This module requires Terraform 0.12. |
| 19 | + |
| 20 | +## Usage |
| 21 | +----- |
15 | 22 | You can use this in your terraform template with the following steps.
|
16 | 23 |
|
17 | 24 | 1. Adding a module resource to your template, e.g. main.tf
|
18 | 25 |
|
19 |
| -```tf |
20 |
| -module "mongodb_instance" { |
| 26 | +```hcl |
| 27 | +module "mongodb" { |
21 | 28 | source = "terraform-alicloud-modules/mongodb/alicloud"
|
22 |
| - engine_version = "${var.engine_version}" |
23 |
| - db_instance_class = "${var.db_instance_class}" |
24 |
| - db_instance_storage = "${var.db_instance_storage}" |
25 |
| - name = "${var.name}" |
26 |
| - instance_charge_type = "${var.instance_charge_type}" |
27 |
| - vswitch_id = "${var.vswitch_id}" |
28 |
| - security_ip_list = "${var.security_ip_list}" |
| 29 | + region = "cn-shanghai" |
| 30 | + ################# |
| 31 | + # MongoDB Instance |
| 32 | + ################# |
| 33 | + replication_factor = 3 |
| 34 | + name = "my-mongo" |
| 35 | + instance_charge_type = "PostPaid" |
| 36 | + db_instance_class = "dds.mongo.mid" |
| 37 | + db_instance_storage = 10 |
| 38 | + period = 1 |
| 39 | + security_ip_list = ["1.1.1.1", "2.2.2.2", "3.3.3.3"] |
| 40 | + vswitch_id = "vsw-uf6ocf31lyoqvw2jmmr9f" |
| 41 | + zone_id = "cn-shanghai-b" |
| 42 | + account_password = "mongo123" |
| 43 | + backup_period = ["Monday", "Wednesday", "Friday"] |
| 44 | + backup_time = "02:00Z-03:00Z" |
| 45 | + tags = { |
| 46 | + Env = "Private" |
| 47 | + Location = "Secret" |
| 48 | + } |
29 | 49 | }
|
30 | 50 | ```
|
31 | 51 |
|
32 |
| -1. Setting `access_key` and `secret_key` values through environment variables: |
33 |
| - |
34 |
| - - ALICLOUD_ACCESS_KEY |
35 |
| - - ALICLOUD_SECRET_KEY |
36 |
| - - ALICLOUD_REGION |
37 |
| - |
38 |
| -## Input |
39 |
| - |
40 |
| -| Name | Description | Type | Default | Required | |
41 |
| -| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | :--------: | :------: | |
42 |
| -| engine_version | Database version. Value options:3.4 3.6 4.0 | string | "" | yes | |
43 |
| -| instance_type | DB Instance type. For details, see [Instance type table](https://www.alibabacloud.com/help/doc-detail/57141.htm). | string | "" | yes | |
44 |
| -| instance_storage | User-defined DB instance storage space. Value range:[10,2000] Increase progressively at a rate of 5 GB. For details, see [Instance type table](https://www.alibabacloud.com/help/doc-detail/26312.htm). | string | 10 | yes | |
45 |
| -| instance_name | The name of DB instance. It a string of 2 to 256 characters. | string | "" | no | |
46 |
| -| instance_charge_type | Valid values are PrePaid, PostPaid, Default to PostPaid. | string | PostPaid | no | "PostPaid" | |
47 |
| -| zone_id | The Zone to launch the DB instance. From version 1.8.1, it supports multiple zone. If it is a multi-zone and vswitch_id is specified, the vswitch must in the one of them. The multiple zone ID can be retrieved by setting multi to "true" in the data source alicloud_zones. | string | "" | no | |
48 |
| -| vswitch_id | VSwitch ID. If the instance type is VPC, this parameter cannot be left blank. | string | "" | no | |
49 |
| -| security_ip_list | List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). | list | [ ] | no | |
50 |
| -| vswitch_id | VSwitch ID. If the instance type is VPC, this parameter cannot be left blank. | string | "" | no | |
51 |
| -| storage_engine | Storage engine; optional values: WiredTiger or RocksDB. | string | WiredTiger | no | |
52 |
| -| replication_factor | Number of replica set nodes. Valid values: [3,5,7] | int | 3 | no | |
53 |
| -| account_password | Password of the root account | string | "" | no | |
54 |
| - |
55 |
| -## Outputs |
56 |
| - |
57 |
| -| Name | Description | |
58 |
| -| ----------------------------- | -------------------------------- | |
59 |
| -| this_db_instance_id | instance ID created | |
60 |
| -| this_db_instance_name | instance name configured | |
61 |
| -| this_db_instance_security_ips | instance security ips configured | |
62 |
| -| this_db_instance_zone_id | instance zone ID created | |
63 |
| -| this_db_instance_vswitch_id | instance vswitch ID created | |
| 52 | +## Examples |
| 53 | + |
| 54 | +* [MongoDB example](https://github.com/terraform-alicloud-modules/terraform-alicloud-mongodb/tree/master/examples/mongodb) |
| 55 | + |
| 56 | +## Module |
| 57 | + |
| 58 | +* [mongodb-3.4-rocksdb](https://github.com/terraform-alicloud-mongodb/tree/mongodb/modules/mongodb-3.4-rocksdb) |
| 59 | +* [mongodb-3.4-wiredtiger](https://github.com/terraform-alicloud-mongodb/tree/mongodb/modules/mongodb-3.4-wiredtiger) |
| 60 | +* [mongodb-4.0-wiredtiger](https://github.com/terraform-alicloud-mongodb/tree/mongodb/modules/mongodb-4.0-wiredtiger) |
| 61 | +* [mongodb-4.2-wiredtiger](https://github.com/terraform-alicloud-mongodb/tree/mongodb/modules/mongodb-4.2-wiredtiger) |
| 62 | + |
| 63 | +## Notes |
| 64 | + |
| 65 | +* This module using AccessKey and SecretKey are from `profile` and `shared_credentials_file`. |
| 66 | +If you have not set them yet, please install [aliyun-cli](https://github.com/aliyun/aliyun-cli#installation) and configure it. |
| 67 | + |
| 68 | + |
| 69 | +Authors |
| 70 | +--------- |
| 71 | +Created and maintained by Yi Jincheng(yi785301535@163.com) |
| 72 | + |
| 73 | +License |
| 74 | +---- |
| 75 | +Apache 2 Licensed. See LICENSE for full details. |
| 76 | + |
| 77 | +Reference |
| 78 | +--------- |
| 79 | +* [Terraform-Provider-Alicloud Github](https://github.com/terraform-providers/terraform-provider-alicloud) |
| 80 | +* [Terraform-Provider-Alicloud Release](https://releases.hashicorp.com/terraform-provider-alicloud/) |
| 81 | +* [Terraform-Provider-Alicloud Docs](https://www.terraform.io/docs/providers/alicloud/index.html) |
0 commit comments