subcategory | layout | page_title | sidebar_current | description |
---|---|---|---|---|
Database as a Service - MongoDB |
ionoscloud |
IonosCloud: ionoscloud_mongo_user |
docs-resource_mongo_user |
Creates and manages DbaaS MongoDB users. |
Manages a DbaaS Mongo User.
resource "ionoscloud_datacenter" "datacenter_example" {
name = "example"
location = "de/txl"
description = "Datacenter for testing dbaas cluster"
}
resource "ionoscloud_lan" "lan_example" {
datacenter_id = ionoscloud_datacenter.datacenter_example.id
public = false
name = "example"
}
resource ionoscloud_mongo_cluster "example_mongo_cluster" {
maintenance_window {
day_of_the_week = "Sunday"
time = "09:00:00"
}
mongodb_version = "5.0"
instances = 3
display_name = "example_mongo_cluster"
location = ionoscloud_datacenter.datacenter_example.location
connections {
datacenter_id = ionoscloud_datacenter.datacenter_example.id
lan_id = ionoscloud_lan.lan_example.id
cidr_list = ["192.168.1.108/24", "192.168.1.109/24", "192.168.1.110/24"]
}
template_id = "6b78ea06-ee0e-4689-998c-fc9c46e781f6"
credentials {
username = "username"
password = "password"
}
}
resource ionoscloud_mongo_user "example_mongo_user" {
cluster_id = ionoscloud_mongo_cluster.example_mongo_cluster.id
username = "myUser"
database = "db1"
password = "abc123-321CBA"
roles {
role = "read"
database = "db1"
}
roles {
role = "readAnyDatabase"
database = "db2"
}
}
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.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.
Resource DbaaS MongoDb User can be imported using the cluster_id
, the database
and the username
e.g.
terraform import ionoscloud_mongo_cluster.mycluser {cluster uuid} {database} {username}