mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
a0dc296ede
We sometimes need to test against cloud databases. Here, we add a Terraform module to start a new AlloyDB cluster and instance, which we can then use for testing purposes. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7002 GitOrigin-RevId: 2d661b5cc6d60e47485ea68b781e13426ed4f097
35 lines
970 B
HCL
35 lines
970 B
HCL
# The AlloyDB cluster, with a single instance.
|
|
|
|
# The initial user password must be provided.
|
|
variable "password" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
resource "google_alloydb_cluster" "default" {
|
|
provider = google-beta
|
|
cluster_id = "${var.name}-testing-alloydb"
|
|
network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}"
|
|
location = local.region
|
|
|
|
initial_user {
|
|
user = var.name
|
|
password = var.password
|
|
}
|
|
}
|
|
|
|
resource "google_alloydb_instance" "primary" {
|
|
provider = google-beta
|
|
cluster = google_alloydb_cluster.default.name
|
|
instance_id = "${var.name}-testing-alloydb-instance"
|
|
instance_type = "PRIMARY"
|
|
depends_on = [
|
|
google_service_networking_connection.default
|
|
]
|
|
}
|
|
|
|
output "url" {
|
|
value = "postgresql://${var.name}:${var.password}@${google_compute_instance.bastion.network_interface.0.access_config.0.nat_ip}/postgres"
|
|
sensitive = true
|
|
}
|