tfmodules/dbaas/ovh/main.tf
gitops_test 3668b94644 sync-modules: mirrored modules of release 3.2.0-F-feature-simpl-31669.676.1150352e
+++ dbaas/README.md
+++ dbaas/ovh/credentials.tf
+++ dbaas/ovh/main.tf
+++ dbaas/ovh/outputs.tf
+++ dbaas/ovh/variables.tf
+++ dbaas/ovh/versions.tf
2026-09-23 13:16:31 +00:00

47 lines
1.6 KiB
HCL

// OVHcloud Managed PostgreSQL. The cloud provider credentials and the
// project (OVH_CLOUD_PROJECT_SERVICE) reach the provider from the runner
// environment, never from module inputs.
resource "ovh_cloud_project_database" "this" {
service_name = var.project_id
description = "${var.name_prefix}-postgresql-${var.deployment_id}"
engine = "postgresql"
version = var.engine_version
plan = var.plan
flavor = var.flavor
nodes {
region = var.region
network_id = var.private_network_id
subnet_id = var.private_subnet_id
}
dynamic "ip_restrictions" {
for_each = var.allowed_ips
content {
ip = ip_restrictions.value
}
}
}
resource "ovh_cloud_project_database_database" "this" {
service_name = ovh_cloud_project_database.this.service_name
engine = ovh_cloud_project_database.this.engine
cluster_id = ovh_cloud_project_database.this.id
name = var.database_name
}
// The user password is ALWAYS generated server side by OVHcloud, it cannot
// be set to an arbitrary value: it is read from the computed .password
// attribute and delivered only through the Vault entry.
resource "ovh_cloud_project_database_postgresql_user" "this" {
service_name = ovh_cloud_project_database.this.service_name
cluster_id = ovh_cloud_project_database.this.id
name = var.username
// Serialize operations against the cluster: OVH DBaaS processes one
// operation at a time per cluster, and concurrent destroys (user +
// database in parallel) intermittently fail with API 500s.
depends_on = [ovh_cloud_project_database_database.this]
}