---
title: 'Ресурс selectel_dbaas_redis_datastore_v1'
sidebar_label: "selectel_dbaas_redis_datastore_v1"
description: 'Creates and manages a Redis cluster in Selectel Managed Databases using public API v1'
sidebar_position: 15
---

# Ресурс selectel\_dbaas\_redis\_datastore\_v1

:::info

Эта инструкция — копия документации Selectel Terraform-провайдера в [Terraform Registry](https://registry.terraform.io/providers/selectel/selectel/latest/docs).

:::

Creates and manages a Redis cluster using public API v1. For more information about Managed Databases, see the [official Selectel documentation](/managed-databases/redis/).

## Example usage \{#example-usage}

```hcl
resource "selectel_dbaas_redis_datastore_v1" "cluster_1" {
  name           = "cluster-1"
  project_id     = selectel_vpc_project_v2.project_1.id
  region         = "ru-3"
  type_id        = data.selectel_dbaas_datastore_type_v1.datastore_type_1.datastore_types[0].id
  subnet_id      = selectel_vpc_subnet_v2.subnet.subnet_id
  node_count     = 3
  flavor_id      = data.selectel_dbaas_flavor_v1.flavor.flavors[0].id
  redis_password = "secret"
  security_groups = ["796f1f0a-d97d-4a8e-904e-4fd5ef57465c", "b9c2e73d-a6c5-4def-994d-ce85e3ce98d3"]
}
```

## Argument Reference \{#argument-reference}

* `name` — (Required) Cluster name. Changing this creates a new cluster.

* `project_id` — (Required) Unique identifier of the associated project. Changing this creates a new cluster. Retrieved from the [selectel\_vpc\_project\_v2](/terraform/selectel-provider-reference/resources/vpc_project_v2) resource. Learn more about [Projects](/access-control/projects/about-projects/).

* `region` — (Required) Pool where the database is located, for example, `ru-3`. Changing this creates a new cluster. Learn more about available pools in [Product availability by location](/infrastructure/product-availability-by-location/#managed-databases).

* `subnet_id` — (Required) Unique identifier of the associated subnet. Changing this creates a new cluster. Retrieved from the [selectel\_vpc\_subnet\_v2](/terraform/selectel-provider-reference/resources/vpc_subnet_v2) resource for a public subnet, or from the [openstack\_networking\_subnet\_v2](/terraform/openstack-provider-reference/networking-neutron/resources/openstack_networking_subnet_v2) resource of the OpenStack provider for a private subnet.

* `type_id` — (Required) Unique identifier of the cluster type. Changing this creates a new cluster. Retrieved from the [selectel\_dbaas\_datastore\_type\_v1](/terraform/selectel-provider-reference/data-sources/dbaas_datastore_type_v1) data source.

* `node_count` — (Required) Number of nodes in the cluster. The available range is from 1 to 3. Learn more about [Replication](/managed-databases/about/about-managed-databases/#fault-tolerance-and-replication).

* `flavor_id` — (Required) Unique identifier of the flavor for the cluster. Retrieved from the [selectel\_dbaas\_flavor\_v1](/terraform/selectel-provider-reference/data-sources/dbaas_flavor_v1) data source.

* `firewall` — (Deprecated) Remove this argument as it is no longer in use and will be removed in the next major version of the provider. To manage a list of IP-addresses with access to the cluster, use the [selectel\_dbaas\_firewall\_v1](/terraform/selectel-provider-reference/resources/dbaas_firewall_v1) resource.

* `restore` — (Optional) Restores parameters for the cluster. Changing this creates a new cluster.

  * `datastore_id` — (Optional) Unique identifier of the cluster from which you restore. To get the cluster ID, in the [Control panel](https://my.selectel.ru/vpc/default/dbaas/), go to **Cloud Platform** ⟶ **Managed Databases** ⟶ copy the ID under the cluster name.

  * `target_time` — (Optional) Time within seven previous days when you have the cluster state to restore.

* `config` — (Optional) Configuration parameters for the cluster. You can retrieve information about available configuration parameters with the [selectel\_dbaas\_configuration\_parameter\_v1](/terraform/selectel-provider-reference/data-sources/dbaas_configuration_parameter_v1) data source.

* `redis_password` — (Required, Sensitive) Cluster password.

* `floating_ips` — (Optional) Assigns public IP addresses to the nodes in the cluster. The network configuration must meet the requirements. Learn more about [public IP addresses and the required network configuration](/managed-databases/redis/public-ip/).

  * master — (Required) Number of public IPs associated with the master. Available values are `0` and `1`.

  * replica — (Required) Number of public IPs associated with the replicas. The minimum value is `0`. The maximum value must be 1 less than the value of the `node_count` argument.

* `backup_retention_days` — (Optional) Number of days to retain backups.

* `logs` — (Optional) Name of an existing or a new log group in the [Logs](/logs/about/about-logs/) service. The name must start with the prefix 's/dbaas/'. It can contain uppercase and lowercase letters, digits and symbols (underscore, hyphen, forward slash, period and hash). The name cannot exceed 512 symbols. For example, s/dbaas/My-first-group. Learn more about [Logs](/managed-databases/redis/logs/).

* `security_groups` — (Optional) List of security groups. If no security group UUIDs are specified when creating the cluster, a default security group will be created and its UUID will be assigned automatically. A cluster must have at least one security group. Learn more about [security groups](/managed-databases/redis/network-access-control/#security-groups-in-managed-databases).

## Attributes Reference \{#attributes-reference}

* `status` — Cluster status.

* `connections` — DNS addresses to connect to the cluster.

## Import \{#import}

You can import a cluster:

```shell
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_redis_datastore_v1.cluster_1 <datastore_id>
```

where:

* `<account_id>` — Selectel account ID. The account ID is in the top right corner of the [Control panel](https://my.selectel.ru/). Learn more about [Registration](/account/registration/).

* `<username>` — Name of the service user. To get the name, in the [Control panel](https://my.selectel.ru/iam/users_management/users?type=service), go to **Identity & Access Management** ⟶ **User management** ⟶ the **Service users** tab ⟶ copy the name of the required user. Learn more about [Service users](/access-control/access-management/).

* `<password>` — Password of the service user.

* `<selectel_project_id>` — Unique identifier of the associated project. To get the ID, in the [Control panel](https://my.selectel.ru/vpc/default/dbaas/), go to **Cloud Platform** ⟶ project name ⟶ copy the ID of the required project. Learn more about [Projects](/access-control/projects/about-projects/).

* `<selectel_pool>` — Pool where the cluster is located, for example, `ru-3`. To get information about the pool, in the [Control panel](https://my.selectel.ru/vpc/default/dbaas/), go to **Cloud Platform** ⟶ **Managed Databases**. The pool is in the **Pool** column.

* `<datastore_id>` — Unique identifier of the cluster, for example, `b311ce58-2658-46b5-b733-7a0f418703f2`. To get the cluster ID, in the [Control panel](https://my.selectel.ru/vpc/default/dbaas/), go to **Cloud Platform** ⟶ **Managed Databases** ⟶ copy the ID under the cluster name.
