Manage Managed Service for PostgreSQL clusters with yandex_mdb_postgresql_cluster
masterThe yandex_mdb_postgresql_cluster resource allows you to manage PostgreSQL clusters within Yandex Cloud.
Important Connectivity Note
To connect to the database, use port 6432. This port number is not configurable.
Best Practices for Users and Databases
Historically, user and database blocks were used within this resource. This is now deprecated and not recommended. Using these blocks can lead to incorrect Terraform plans when adding or removing resources.
Instead, use the following dedicated resources for managing cluster contents:
yandex_mdb_postgresql_useryandex_mdb_postgresql_database
resource "yandex_mdb_postgresql_cluster" "my_cluster" {
name = "test"
environment = "PRESTABLE"
network_id = yandex_vpc_network.foo.id
config {
version = 15
resources {
resource_preset_id = "s2.micro"
disk_type_id = "network-ssd"
disk_size = 16
}
postgresql_config = {
max_connections = 395
enable_parallel_hash = true
autovacuum_vacuum_scale_factor = 0.34
default_transaction_isolation = "TRANSACTION_ISOLATION_READ_COMMITTED"
shared_preload_libraries = "SHARED_PRELOAD_LIBRARIES_AUTO_EXPLAIN,SHARED_PRELOAD_LIBRARIES_PG_HINT_PLAN"
}
}
maintenance_window {
type = "WEEKLY"
day = "SAT"
hour = 12
}
host {
zone = "ru-central1-d"
subnet_id = yandex_vpc_subnet.foo.id
}
}