---
title: "Resource selectel_dbaas_postgresql_extension_v1"
sidebar_label: "selectel_dbaas_postgresql_extension_v1"
description: "Creates and manages a PostgreSQL extension in Selectel Managed Databases using public API v1."
sidebar_position: 12
---

# Resource selectel\_dbaas\_postgresql\_extension\_v1

:::info

This instruction is a copy of the Selectel Terraform provider documentation in the [Terraform Registry](https://registry.terraform.io/providers/selectel/selectel/latest/docs).

:::

Creates and manages a PostgreSQL extension using Public API v1. Applicable to PostgreSQL, PostgreSQL for 1C, and PostgreSQL TimescaleDB clusters. For more information about extensions, see the official Selectel documentation for [PostgreSQL](/managed-databases/postgresql/), [PostgreSQL for 1C](/managed-databases/postgresql-for-1c/), and [PostgreSQL TimescaleDB](/managed-databases/timescaledb/).

## Example usage \{#example-usage}

```hcl
resource "selectel_dbaas_postgresql_extension_v1" "extension_1" {
  project_id             = selectel_vpc_project_v2.project_1.id
  region                 = "ru-3"
  datastore_id           = selectel_dbaas_postgresql_datastore_v1.cluster_1.id
  database_id            = selectel_dbaas_postgresql_database_v1.database_1.id
  available_extension_id = data.selectel_dbaas_available_extension_v1.ae.available_extensions[0].id
}
```

## Argument Reference \{#argument-reference}

* `project_id` — (Required) Unique identifier of the associated project. Changing this parameter recreates the extension. 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 parameter recreates the extension. Learn more about available pools in the [Availability matrix](/infrastructure/product-availability-by-location/#managed-databases).

* `datastore_id` — (Required) Unique identifier of the associated cluster. Changing this parameter recreates the extension. Retrieved from the [selectel\_dbaas\_postgresql\_datastore\_v1](/terraform/selectel-provider-reference/resources/dbaas_postgresql_datastore_v1) resource.

* `database_id` — (Required) Unique identifier of the associated database. Changing this parameter recreates the extension. Retrieved from the [selectel\_dbaas\_postgresql\_database\_v1](/terraform/selectel-provider-reference/resources/dbaas_postgresql_database_v1) resource.

* `available_extension_id` — (Required) Unique identifier of the extension to be created. Changing this parameter recreates the extension. Retrieved from the [selectel\_dbaas\_available\_extension\_v1](/terraform/selectel-provider-reference/data-sources/dbaas_available_extension_v1) data source.

## Attributes Reference \{#attributes-reference}

* `status` - Extension status.

## Import \{#import}

You can import an extension:

```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_postgresql_extension_v1.extension_1 <extension_id>
```

where:

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

* `<username>` — Service user name. To find 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>` — Service user password.

* `<selectel_project_id>` — Unique identifier of the associated project. To get the ID, in the [Control panel](https://my.selectel.ru/vpc/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 find the pool, in the [Control panel](https://my.selectel.ru/vpc/default/dbaas/), go to **Cloud Platform** ⟶ **Managed Databases**. The pool is displayed in the **Pool** column.

* `<extension_id>` — Unique identifier of the extension, for example, `b311ce58-2658-46b5-b733-7a0f418703f2`. To get the extension ID, use the [Selectel Cloud Management API](https://developers.selectel.ru/docs/selectel-cloud-platform/dbaas_api/).
