postgress.tf 984 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # ==========================
  2. # YC MDB Postgress Resources
  3. # ==========================
  4. resource "yandex_mdb_postgresql_cluster" "pg_cluster" {
  5. folder_id = "${data.yandex_resourcemanager_folder.kc_folder.id}"
  6. name = var.pg_db_name
  7. environment = "PRODUCTION"
  8. network_id = "${data.yandex_vpc_network.kc_net.id}"
  9. config {
  10. version = var.pg_db_ver
  11. resources {
  12. resource_preset_id = "s2.micro"
  13. disk_type_id = "network-ssd"
  14. disk_size = 10
  15. }
  16. }
  17. host {
  18. zone = var.kc_zone_id
  19. subnet_id = "${data.yandex_vpc_subnet.kc_subnet.id}"
  20. }
  21. }
  22. resource "yandex_mdb_postgresql_user" "pg_user" {
  23. cluster_id = yandex_mdb_postgresql_cluster.pg_cluster.id
  24. name = var.pg_db_user
  25. password = var.pg_db_pass
  26. }
  27. resource "yandex_mdb_postgresql_database" "pg_db" {
  28. cluster_id = yandex_mdb_postgresql_cluster.pg_cluster.id
  29. name = var.pg_db_name
  30. owner = yandex_mdb_postgresql_user.pg_user.name
  31. lc_collate = "en_US.UTF-8"
  32. lc_type = "en_US.UTF-8"
  33. }