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
48 lines
1.4 KiB
HCL
48 lines
1.4 KiB
HCL
# AlloyDB requires a dedicated virtual private network.
|
|
|
|
resource "google_compute_network" "default" {
|
|
name = "${var.name}-testing-alloydb-network"
|
|
}
|
|
|
|
resource "google_compute_global_address" "private_ip_alloc" {
|
|
name = "${var.name}-testing-alloydb-cluster"
|
|
address_type = "INTERNAL"
|
|
purpose = "VPC_PEERING"
|
|
prefix_length = 16
|
|
network = google_compute_network.default.id
|
|
}
|
|
|
|
resource "google_service_networking_connection" "default" {
|
|
network = google_compute_network.default.id
|
|
service = "servicenetworking.googleapis.com"
|
|
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
|
|
}
|
|
|
|
# Allows instances with the tag "ssh" to expose port 22.
|
|
resource "google_compute_firewall" "ssh" {
|
|
name = "${var.name}-testing-alloydb-allow-ssh"
|
|
allow {
|
|
ports = ["22"]
|
|
protocol = "tcp"
|
|
}
|
|
direction = "INGRESS"
|
|
network = google_compute_network.default.id
|
|
priority = 1000
|
|
source_ranges = ["0.0.0.0/0"]
|
|
target_tags = ["ssh"]
|
|
}
|
|
|
|
# Allows instances with the tag "postgres" to expose port 5432.
|
|
resource "google_compute_firewall" "postgres" {
|
|
name = "${var.name}-testing-alloydb-allow-postgres"
|
|
allow {
|
|
ports = ["5432"]
|
|
protocol = "tcp"
|
|
}
|
|
direction = "INGRESS"
|
|
network = google_compute_network.default.id
|
|
priority = 1000
|
|
source_ranges = ["0.0.0.0/0"]
|
|
target_tags = ["postgres"]
|
|
}
|