Перейти к основному содержимому
selectel_dbaas_postgresql_database_v1
Последнее изменение:

selectel_dbaas_postgresql_database_v1

Creates and manages a PostgreSQL database using public API v1. Applicable to PostgreSQL, PostgreSQL for 1C, and PostgreSQL TimescaleDB databases. The type is determined by the selectel_dbaas_postgresql_datastore_v1 resource. For more information about Managed Databases, see the official Selectel documentation for PostgreSQL, PostgreSQL for 1C, and PostgreSQL TimescaleDB.

Example usage

resource "selectel_dbaas_postgresql_database_v1" "database_1" {
project_id = selectel_vpc_project_v2.project_1.id
region = "ru-3"
datastore_id = selectel_dbaas_postgresql_datastore_v1.datastore_1.id
owner_id = selectel_dbaas_user_v1.user_1.id
name = "database_1"
}

Argument Reference

  • name - (Required) Database name. Changing this creates a new database.

  • project_id - (Required) Unique identifier of the associated Cloud Platform project. Changing this creates a new database. Retrieved from the selectel_vpc_project_v2 resource. Learn more about Cloud Platform projects.

  • region - (Required) Pool where the database is located, for example, ru-3. Changing this creates a new database. Learn more about available pools in the Availability matrix.

  • datastore_id - (Required) Unique identifier of the associated datastore. Changing this creates a new database. Retrieved from the selectel_dbaas_mysql_datastore_v1 resource.

  • owner_id - (Required) Unique identifier of the database owner. Retrieved from the selectel_dbaas_user_v1 resource.

  • lc_collate - (Optional) LC_COLLATE setting for the PostgreSQL datastore. Determined when you create a database and you cannot change it afterwards. The default value is C.

    To get a list of available values, in the Control panel, go to Cloud PlatformManaged Databases⟶ the cluster page ⟶ the Databases tab ⟶ Create ⟶ the LC_COLLATE field. The list of appropriate values is in the drop-down list.

  • lc_ctype - (Optional) LC_CTYPE setting for the PostgreSQL datastore. Determined when you create a database and you cannot change it afterwards. The default value is C.

    To get a list of available values, in the Control panel, go to Cloud PlatformManaged Databases ⟶ the cluster page ⟶ the Databases tab ⟶ Create ⟶ the LC_CTYPE field. The list of appropriate values is in the drop-down list.

Attributes Reference

  • status - Database status.

Import

You can import a database:

export OS_DOMAIN_NAME=<account_id>
export OS_USERNAME=<username>
export OS_PASSWORD=<password>
export SEL_PROJECT_ID=<selectel_project_id>
export SEL_REGION=<selectel_pool>
terraform import selectel_dbaas_postgresql_database_v1.database_1 <database_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 top right corner of the Control panel, go to the account menu ⟶ Profile and SettingsUser 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 Cloud Platform project. To get the project ID, in the Control panel, go to Cloud Platform ⟶ project name ⟶ copy the ID of the required project. Learn more about Cloud Platform 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 PlatformManaged Databases. The pool is in the Pool column.

  • <database_id> — Unique identifier of the database, for example, b311ce58-2658-46b5-b733-7a0f418703f2. To get the database ID, in the Control panel, go to Cloud PlatformManaged Databases ⟶ the cluster page ⟶ the Databases tab ⟶ copy the ID under the database name.