selectel_dbaas_user_v1
This instruction is a copy of the Selectel Terraform provider's documentation in the Terraform Registry.
Creates and manages a user in Managed Databases using public API v1. Not applicable to Redis. For more information about managing users in Managed Databases, see the official Selectel documentation for PostgreSQL, PostgreSQL for 1C, PostgreSQL TimescaleDB, MySQL semi-sync, MySQL sync and Kafka.
Example usage
PostgreSQL, PostgreSQL for 1C, and PostgreSQL TimescaleDB
resource "selectel_dbaas_user_v1" "user_1" {
project_id = selectel_vpc_project_v2.project_1.id
region = "ru-3"
datastore_id = selectel_dbaas_postgresql_datastore_v1.datastore_1.id
name = "user"
password = "secret"
}
MySQL semi-sync and MySQL sync
resource "selectel_dbaas_user_v1" "user_1" {
project_id = selectel_vpc_project_v2.project_1.id
region = "ru-3"
datastore_id = selectel_dbaas_mysql_datastore_v1.datastore_1.id
name = "user"
password = "secret"
}
Kafka
resource "selectel_dbaas_user_v1" "user_1" {
project_id = selectel_vpc_project_v2.project_1.id
region = "ru-3"
datastore_id = selectel_dbaas_kafka_datastore_v1.datastore_1.id
name = "user"
password = "secret"
}
Argument Reference
-
name
— (Required, Sensitive) User name. Changing this creates a new user. -
password
— (Required, Sensitive) User password. -
project_id
— (Required) Unique identifier of the associated project. Changing this creates a new user. Retrieved from the selectel_vpc_project_v2 resource. Learn more about Projects. -
region
— (Required) Pool where the database is located, for example,ru-3
. Changing this creates a new user. Learn more about available pools in the Availability matrix. -
datastore_id
— (Required) Unique identifier of the associated datastore. Changing this creates a new user. Retrieved from the selectel_dbaas_postgresql_datastore_v1 or selectel_dbaas_mysql_datastore_v1 resource depending on the datastore type you use.
Attributes Reference
status
— User status.
Import
You can import a user:
export OS_DOMAIN_NAME=<account_id>
export OS_USERNAME=<username>
export OS_PASSWORD=<password>
export INFRA_PROJECT_ID=<selectel_project_id>
export INFRA_REGION=<selectel_pool>
terraform import selectel_dbaas_user_v1.user_1 <user_id>
where:
-
<account_id>
— Selectel account ID. The account ID is in the top right corner of the Control panel. Learn more about Registration. -
<username>
— Name of the service user. To get the name, in the Control panel, go to Identity & Access Management ⟶ User management ⟶ the Service users tab ⟶ copy the name of the required user. Learn more about Service users. -
<password>
— Password of the service user. -
<selectel_project_id>
— Unique identifier of the associated project. To get the ID, in the Control panel, go to Cloud Platform ⟶ project name ⟶ copy the ID of the required project. Learn more about Projects. -
<selectel_pool>
— Pool where the cluster is located, for example,ru-3
. To get information about the pool, in the Control panel, go to Cloud Platform ⟶ Managed Databases. The pool is in the Pool Column. -
<user_id>
— Unique identifier of the user, for example,b311ce58-2658-46b5-b733-7a0f418703f2
. To get the user ID in the Control panel, go to Cloud Platform ⟶ Managed Databases ⟶ the cluster page ⟶ the Users tab. The user ID is under the user name.