|
1 | 1 | <!-- BEGIN MODULE HOOK --> |
2 | 2 |
|
3 | 3 | <!-- Update the title to match the module name and add a description --> |
4 | | -# Terraform Modules Template Project |
| 4 | +# IBM Cloud Databases for ICD MongoDB module |
5 | 5 | <!-- UPDATE BADGE: Update the link for the following badge--> |
6 | | -[-red)](https://terraform-ibm-modules.github.io/documentation/#/badge-status) |
7 | | -[](https://github.com/terraform-ibm-modules/terraform-ibm-module-template/actions/workflows/ci.yml) |
| 6 | +[-green)](https://terraform-ibm-modules.github.io/documentation/#/badge-status) |
| 7 | +[](https://github.com/terraform-ibm-modules/terraform-ibm-icd-mongodb/actions/workflows/ci.yml) |
8 | 8 | [](https://github.com/pre-commit/pre-commit) |
9 | | -[](https://github.com/terraform-ibm-modules/terraform-ibm-module-template/releases/latest) |
| 9 | +[](https://github.com/terraform-ibm-modules/terraform-ibm-icd-mongodb/releases/latest) |
10 | 10 | [](https://renovatebot.com/) |
11 | 11 | [](https://github.com/semantic-release/semantic-release) |
12 | 12 |
|
13 | 13 | <!-- Remove the content in this H2 heading after completing the steps --> |
14 | 14 |
|
15 | | -## Submit a new module |
16 | | - |
17 | | -:+1::tada: Thank you for taking the time to contribute! :tada::+1: |
18 | | - |
19 | | -This template repository exists to help you create Terraform modules for IBM Cloud. |
20 | | - |
21 | | -The default structure includes the following files: |
22 | | - |
23 | | -- `README.md`: A description of the module |
24 | | -- `main.tf`: The logic for the module |
25 | | -- `version.tf`: The required terraform and provider versions |
26 | | -- `variables.tf`: The input variables for the module |
27 | | -- `outputs.tf`: The values that are output from the module |
28 | | -For more information, see [Module structure](https://terraform-ibm-modules.github.io/documentation/#/module-structure) in the project documentation. |
29 | | - |
30 | | -You can add other content to support what your module does and how it works. For example, you might add a `scripts/` directory that contains shell scripts that are run by a `local-exec` `null_resource` in the Terraform module. |
31 | | - |
32 | | -Follow this process to create and submit a Terraform module. |
33 | | - |
34 | | -### Create a repo from this repo template |
35 | | - |
36 | | -1. Create a repository from this repository template by clicking `Use this template` in the upper right of the GitHub UI. |
37 | | -    <br>For more information about creating a repository from a template, see the [GitHub docs](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template). |
38 | | -1. Select `terraform-ibm-modules` as the owner. |
39 | | -1. Enter a name for the module in format `terraform-ibm-<NAME>`, where `<NAME>` reflects the type of infrastructure that the module manages. |
40 | | -    <br>Use hyphens as delimiters for names with multiple words (for example, terraform-ibm-`activity-tracker`). |
41 | | -1. Provide a short description of the module. |
42 | | -    <br>The description is displayed under the repository name on the [organization page](https://github.com/terraform-ibm-modules) and in the **About** section of the repository. Use the description to help users understand the purpose of your module. For more information, see [module names and descriptions](https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=module-names-and-descriptions) in the docs. |
43 | | - |
44 | | -### Clone the repo and set up your development environment |
45 | | - |
46 | | -Locally clone the new repository and set up your development environment by completing the tasks in [Local development setup](https://terraform-ibm-modules.github.io/documentation/#/local-dev-setup) in the project documentation. |
47 | | - |
48 | | -### Update the repo name and description in source control |
49 | | - |
50 | | -To help make sure that the repo name and description are not changed except through pull requests, they are defined in the `settings.yml` file. |
51 | | - |
52 | | -Check to make sure that values are uncommented and correct: |
53 | | - |
54 | | -1. Open the [settings.yml](.github/settings.yml) file. |
55 | | -1. If not already updated, uncomment the `name` and `description` properties and set the values to what you specified when you requested the repo. |
56 | | - |
57 | | -### Update the Terraform files |
58 | | - |
59 | | -Implement the logic for your module by updating the `main.tf`, `version.tf`, `variables.tf`, and `outputs.tf` Terraform files. For more information, see [Creating Terraform on IBM Cloud templates](https://cloud.ibm.com/docs/ibm-cloud-provider-for-terraform?topic=ibm-cloud-provider-for-terraform-create-tf-config). |
60 | | - |
61 | | -### Create examples and tests |
62 | | - |
63 | | -Add one or more examples in the `examples` directory that consume your new module, and configure tests for them in the `tests` directory. For more information about tests, see [Tests](https://terraform-ibm-modules.github.io/documentation/#/tests). |
64 | | - |
65 | | -### Update the content in the readme file |
66 | | - |
67 | | -After you implement the logic for your module and create examples and tests, update this readme file in your repository by following these steps: |
68 | | - |
69 | | -1. Update the title heading and add a description about your module. |
70 | | -1. Update the badge links. |
71 | | -1. Remove all the content in this H2 heading section. |
72 | | -1. Complete the [Usage](#usage) and [Required IAM access policies](#required-iam-access-policies) sections. The [Examples](#examples) and [Requirements](#requirements) section are populated by a pre-commit hook. |
73 | | - |
74 | | -### Commit your code and submit your module for review |
75 | | - |
76 | | -1. Before you commit any code, review [Contributing to the IBM Cloud Terraform modules project](https://terraform-ibm-modules.github.io/documentation/#/contribute-module) in the project documentation. |
77 | | -1. Create a pull request for review. |
78 | | - |
79 | | -### Post-merge steps |
80 | | - |
81 | | -After the first PR for your module is merged, follow these post-merge steps: |
82 | | - |
83 | | -1. Create a PR to enable the upgrade test by removing the `t.Skip` line in `tests/pr_test.go`. |
84 | | - |
85 | | -<!-- Remove the content in this previous H2 heading --> |
86 | | - |
87 | 15 | ## Usage |
88 | 16 |
|
89 | | -<!-- |
90 | | -Add an example of the use of the module in the following code block. |
| 17 | +:exclamation: **Important:** This module does not support major version upgrades or updates to encryption and backup encryption keys. To upgrade the version, create a new MongoDB instance with the updated version, and follow the steps in [Upgrading to a new major version](https://cloud.ibm.com/docs/databases-for-mongodb?topic=databases-for-mongodb-upgrading) in the IBM Cloud docs. |
91 | 18 |
|
92 | | -Use real values instead of "var.<var_name>" or other placeholder values |
93 | | -unless real values don't help users know what to change. |
94 | | ---> |
95 | | - |
96 | | -```hcl |
| 19 | +```terraform |
| 20 | +module "mongodb" { |
| 21 | + # replace "master" with a GIT release version to lock into a specific release |
| 22 | + source = "git::https://github.ibm.com/GoldenEye/icd-mongodb-module?ref=master" |
| 23 | + resource_group_id = "xxXXxxXXxXxXXXXxxXxxxXXXXxXXXXX" |
| 24 | + region = "us-south" |
| 25 | + instance_name = "my-mongodb-instance" |
| 26 | +} |
97 | 27 |
|
98 | 28 | ``` |
99 | 29 |
|
100 | 30 | ## Required IAM access policies |
101 | 31 |
|
102 | | -<!-- PERMISSIONS REQUIRED TO RUN MODULE |
103 | | -If this module requires permissions, uncomment the following block and update |
104 | | -the sample permissions, following the format. |
105 | | -Replace the sample Account and IBM Cloud service names and roles with the |
106 | | -information in the console at |
107 | | -Manage > Access (IAM) > Access groups > Access policies. |
108 | | ---> |
109 | | - |
110 | | -<!-- |
111 | 32 | You need the following permissions to run this module. |
112 | 33 |
|
113 | 34 | - Account Management |
114 | | - - **Sample Account Service** service |
115 | | - - `Editor` platform access |
116 | | - - `Manager` service access |
117 | | - - IAM Services |
118 | | - - **Sample Cloud Service** service |
119 | | - - `Administrator` platform access |
120 | | ---> |
121 | | - |
122 | | -<!-- NO PERMISSIONS FOR MODULE |
123 | | -If no permissions are required for the module, uncomment the following |
124 | | -statement instead the previous block. |
125 | | ---> |
126 | | - |
127 | | -<!-- No permissions are needed to run this module.--> |
| 35 | + - **Databases for MongoDB** service |
| 36 | + - `Editor` role access |
| 37 | + |
128 | 38 | <!-- END MODULE HOOK --> |
129 | 39 | <!-- BEGIN EXAMPLES HOOK --> |
130 | 40 | ## Examples |
131 | 41 |
|
| 42 | +- [ Autoscale example](examples/autoscale) |
| 43 | +- [ Encryption example](examples/complete) |
132 | 44 | - [ Default example](examples/default) |
133 | | -- [ Example that uses existing resources](examples/existing-resources) |
134 | | -- [ Non default example](examples/non-default) |
135 | 45 | <!-- END EXAMPLES HOOK --> |
136 | 46 | <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
137 | 47 | ## Requirements |
138 | 48 |
|
139 | 49 | | Name | Version | |
140 | 50 | |------|---------| |
141 | | -| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | |
| 51 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 | |
| 52 | +| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.49.0 | |
142 | 53 |
|
143 | 54 | ## Modules |
144 | 55 |
|
145 | 56 | No modules. |
146 | 57 |
|
147 | 58 | ## Resources |
148 | 59 |
|
149 | | -No resources. |
| 60 | +| Name | Type | |
| 61 | +|------|------| |
| 62 | +| [ibm_database.mongodb](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/database) | resource | |
150 | 63 |
|
151 | 64 | ## Inputs |
152 | 65 |
|
153 | | -No inputs. |
| 66 | +| Name | Description | Type | Default | Required | |
| 67 | +|------|-------------|------|---------|:--------:| |
| 68 | +| <a name="input_allowlist"></a> [allowlist](#input\_allowlist) | (Optional, List of Objects) A list of allowed IP addresses for the database. | <pre>list(object({<br> address = string<br> description = string<br> }))</pre> | `[]` | no | |
| 69 | +| <a name="input_auto_scaling"></a> [auto\_scaling](#input\_auto\_scaling) | Configure rules to allow your database to automatically increase its resources. Single block of autoscaling is allowed at once. | <pre>object({<br> cpu = object({<br> rate_increase_percent = optional(number)<br> rate_limit_count_per_member = optional(number)<br> rate_period_seconds = optional(number)<br> rate_units = optional(string)<br> })<br> disk = object({<br> capacity_enabled = optional(bool)<br> free_space_less_than_percent = optional(number)<br> io_above_percent = optional(number)<br> io_over_period = optional(string)<br> io_enabled = optional(bool)<br> rate_increase_percent = optional(number)<br> rate_limit_mb_per_member = optional(number)<br> rate_period_seconds = optional(number)<br> rate_units = optional(string)<br> })<br> memory = object({<br> io_above_percent = optional(number)<br> io_enabled = optional(bool)<br> io_over_period = optional(string)<br> rate_increase_percent = optional(number)<br> rate_limit_mb_per_member = optional(number)<br> rate_period_seconds = optional(number)<br> rate_units = optional(string)<br> })<br> })</pre> | <pre>{<br> "cpu": {},<br> "disk": {},<br> "memory": {}<br>}</pre> | no | |
| 70 | +| <a name="input_backup_encryption_key_crn"></a> [backup\_encryption\_key\_crn](#input\_backup\_encryption\_key\_crn) | (Optional) The CRN of a key protect key, that you want to use for encrypting disk that holds deployment backups. If null, will use 'key\_protect\_key\_crn' as encryption key. If 'key\_protect\_key\_crn' is also null database is encrypted by using randomly generated keys. | `string` | `null` | no | |
| 71 | +| <a name="input_configuration"></a> [configuration](#input\_configuration) | Database Configuration in JSON format. | <pre>object({<br> maxmemory = optional(number)<br> maxmemory-policy = optional(string)<br> appendonly = optional(string)<br> maxmemory-samples = optional(number)<br> stop-writes-on-bgsave-error = optional(string)<br> })</pre> | `null` | no | |
| 72 | +| <a name="input_cpu_count"></a> [cpu\_count](#input\_cpu\_count) | Number of CPU cores available to the mongodb instance | `number` | `7` | no | |
| 73 | +| <a name="input_disk_mb"></a> [disk\_mb](#input\_disk\_mb) | Disk available to the mongodb instance | `number` | `20480` | no | |
| 74 | +| <a name="input_endpoints"></a> [endpoints](#input\_endpoints) | Endpoints available to the mongodb instance (public, private, public-and-private) | `string` | `"private"` | no | |
| 75 | +| <a name="input_instance_name"></a> [instance\_name](#input\_instance\_name) | Name of the MongoDB instance | `string` | n/a | yes | |
| 76 | +| <a name="input_key_protect_key_crn"></a> [key\_protect\_key\_crn](#input\_key\_protect\_key\_crn) | (Optional) The root key CRN of a Key Management Service like Key Protect or Hyper Protect Crypto Service (HPCS) that you want to use for disk encryption. If `null`, database is encrypted by using randomly generated keys. See https://cloud.ibm.com/docs/cloud-databases?topic=cloud-databases-key-protect&interface=ui#key-byok for current list of supported regions for BYOK | `string` | `null` | no | |
| 77 | +| <a name="input_members"></a> [members](#input\_members) | Allocated number of members | `number` | `3` | no | |
| 78 | +| <a name="input_memory_mb"></a> [memory\_mb](#input\_memory\_mb) | Memory available to the mongodb instance | `number` | `1024` | no | |
| 79 | +| <a name="input_mongodb_version"></a> [mongodb\_version](#input\_mongodb\_version) | The version of the mongodb to be provisioned | `string` | `null` | no | |
| 80 | +| <a name="input_plan"></a> [plan](#input\_plan) | The name of the service plan that you choose for your mongodb instance | `string` | `"standard"` | no | |
| 81 | +| <a name="input_region"></a> [region](#input\_region) | The IBM Cloud region where instance will be created | `string` | `"us-south"` | no | |
| 82 | +| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The ID of the IMB Cloud resource group where you want to create the instance | `string` | n/a | yes | |
| 83 | +| <a name="input_tags"></a> [tags](#input\_tags) | A list of tags that you want to add to your instance | `list(any)` | `[]` | no | |
154 | 84 |
|
155 | 85 | ## Outputs |
156 | 86 |
|
157 | | -No outputs. |
| 87 | +| Name | Description | |
| 88 | +|------|-------------| |
| 89 | +| <a name="output_id"></a> [id](#output\_id) | mongodb instance id | |
| 90 | +| <a name="output_version"></a> [version](#output\_version) | mongodb instance version | |
158 | 91 | <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
159 | 92 | <!-- BEGIN CONTRIBUTING HOOK --> |
160 | 93 |
|
|
0 commit comments