# ionoscloud\_mongo\_user

The **DbaaS Mongo User data source** can be used to search for and return an existing DbaaS MongoDB User. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

## Example Usage

### By username

```hcl
data "ionoscloud_mongo_user" "example" {
  cluster_id	= "cluster_id"
  username	= "username"
}
```

## Argument reference

* `cluster_id` - (Required)\[string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
* `username` - (Required)\[string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
* `database` - (Required)\[string] The user database to use for authentication. Updates to the value of the field force the cluster to be re-created.
* `password` - (Required)\[string] User password. Updates to the value of the field force the cluster to be re-created.
* `roles` - (Required)\[string] a list of mongodb user roles. Updates to the value of the field force the cluster to be re-created.
  * `role` - (Required)\[true] Mongodb user role. Examples: read, readWrite, readAnyDatabase, readWriteAnyDatabase, dbAdmin, dbAdminAnyDatabase, clusterMonitor and enableSharding.
  * `database` - (Required)\[true] Database on which to apply the role.

**NOTE:** MongoDb users do not support update at the moment. Changing any attribute will result in the user being re-created.

## Import

Resource DbaaS MongoDb User can be imported using the `cluster_id`, the `database` and the `username` e.g.

```shell
terraform import ionoscloud_mongo_cluster.mycluser cluster uuid database username
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/terraform-provider/data-sources/dbaas_mongo_user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
