Skip to content

Commit

Permalink
fix(mongodb_user): Fix MongoDb users import and minor errors (#485)
Browse files Browse the repository at this point in the history
* fix(mongodb_user): Fix MongoDb users import and minor errors

* docs: Change the description of the ID

* fix: Fix log typos

* fix: Change log message

* fix(mongodb_user): Change argument from a list to a set

* fix: Fix golangci-lint gosimple error

* chore: Update by review only once for each API

* chore: Delete logs that print password
  • Loading branch information
youngmn authored Jan 7, 2025
1 parent ffe66fc commit 58d3fcf
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 196 deletions.
6 changes: 2 additions & 4 deletions docs/data-sources/mongodb_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ user_list = {

The following arguments are required:

* `id` - (Required) MongoDB Users number. Either `id` or `mongodb_instance_no` must be provided.
* `mongodb_instance_no` - (Required) MongoDB Instance No, either `id` or `mongodb_instance_no` must be provided.
* `id` - (Required) MongoDB instance number.
* `output_file` - (Optional) The name of file that can save data source after running `terraform plan`.
* `filter` - (Optional) Custom filter block as described below.
* `name` - (Required) The name of the field to filter by
Expand All @@ -54,6 +53,5 @@ This data source exports the following attributes in addition to the argument ab

* `mongodb_user_list` - The list of users to add.
* `name` - MongoDB User ID.
* `password` - MongoDB User Password.
* `database_name` - MongoDB Database Name that MongoDB User belongs to.
* `authority` - Mongodb User Authority.
* `authority` - Mongodb User Authority.
18 changes: 7 additions & 11 deletions docs/resources/mongodb_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subcategory: "MongoDB"

# Resource: ncloud_mongodb_users

Provides a MongoDB User list resources.
Provides a MongoDB User set resources.

~> **NOTE:** This resource only supports VPC environment.

Expand Down Expand Up @@ -34,8 +34,8 @@ resource "ncloud_mongodb" "mongodb" {
}
resource "ncloud_mongodb_users" "mongodb_users" {
mongodb_instance_no = ncloud_mongodb.mongodb.id
mongodb_user_list = [
id = ncloud_mongodb.mongodb.id
mongodb_user_set = [
{
name = "testuser1",
password = "t123456789!",
Expand All @@ -53,20 +53,16 @@ resource "ncloud_mongodb_users" "mongodb_users" {
```

## Argument Reference

The following arguments are supported:

* `mongodb_instance_no` - (Required) The ID of the associated MongoDB Instance.
* `mongodb_user_list` - The list of users to add.
* `id` - (Required) The ID of the associated MongoDB Instance.
* `mongodb_user_set` - The set of users to add.
* `name` - (Required) MongoDB User ID. Allows only alphabets, numbers and underbar (_). Must start with an alphabetic character. Min: 4, Max: 16
* `password` - (Required) MongoDB User Password. At least one English alphabet, number and special character must be included. Certain special characters ( ` & + \ " ' / space ) cannot be used. Min: 8 , Max: 20
* `database_name` - (Required) MongoDB Database Name to add MongoDB User. Allows only alphabets, numbers and underbar (_). Must start with an alphabetic character. Min: 4 , Max: 30
* `authority` - (Required) MongoDB User Authority. You can select `READ|READ_WRITE`.

## Attribute Reference
In addition to all arguments above, the following attributes are exported

* `id` - MongoDB User list number. (MongoDB Instance number)

## Import

### `terraform import` command
Expand All @@ -86,4 +82,4 @@ import {
to = ncloud_mongodb_users.rsc_name
id = "12345"
}
```
```
Loading

0 comments on commit 58d3fcf

Please sign in to comment.