|
1 | 1 | # terraform-alicloud-mongodb
|
2 |
| -Terraform module which creates MongoDB instance and other resources on Alibaba Cloud |
| 2 | + |
| 3 | +Terraform module which creates MongoDB instance on Alibaba Cloud |
| 4 | + |
| 5 | +## mongodb replica instance |
| 6 | + |
| 7 | +Terraform module which creates MongoDB replica instance resources on Alibaba Cloud |
| 8 | + |
| 9 | +These types of resources are supported: |
| 10 | + |
| 11 | +- [mongodb_instance] (https://www.terraform.io/docs/providers/alicloud/r/mongodb_instance.html) |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +You can use this in your terraform template with the following steps. |
| 16 | + |
| 17 | +1. Adding a module resource to your template, e.g. main.tf |
| 18 | + |
| 19 | +```tf |
| 20 | +module "mongodb_instance" { |
| 21 | + 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 | +} |
| 30 | +``` |
| 31 | + |
| 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 | |
0 commit comments