Deleting a user
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To delete a Valkey™ user:
-
See the description of the CLI command for deleting a user:
yc managed-redis user delete --help -
To delete a user, run this command:
yc managed-redis user delete <username> \ --cluster-id=<cluster_ID>Where
--cluster-idis the cluster ID. You can get the cluster ID with the list of clusters in the folder.You can get the username with the list of users in the cluster.
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Delete the
yandex_mdb_redis_userresource with the target user’s description. -
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
-
Run this CLI command to make sure the user was deleted:
yc managed-redis user list \ --cluster-id=<cluster_ID>Learn more on how to get a list of users here.
Timeouts
The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring it from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the timeout are aborted.
How do I change these limits?
Add the timeouts section to your cluster description, such as the following:
resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Call the User.Delete method, e.g., via the following cURL
request:curl \ --request DELETE \ --header "Authorization: Bearer $IAM_TOKEN" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/users/<username>'You can get the cluster ID with the list of clusters in the folder.
You can get the username with the list of users in the cluster.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Call the UserService.Delete method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/user_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d '{ "cluster_id": "<cluster_ID>", "user_name": "<username>" }' \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.UserService.DeleteWhere:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
user_name: Username.You can get the username with the list of users in the cluster.
-
-
Check the server response to make sure your request was successful.