Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bq connection locations configurable #185

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/postgresql/gcp/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ variable "replication" {}
variable "connection_users" {
type = list(string)
}
variable "big_query_connection_location" {}

output "user" {
value = postgresql_role.user.name
Expand Down Expand Up @@ -138,7 +139,7 @@ resource "google_bigquery_connection" "db" {
project = var.gcp_project
friendly_name = "${var.db_name}-connection"
description = "Connection to ${var.db_name} database"
location = "US"
location = var.big_query_connection_location

cloud_sql {
instance_id = var.pg_instance_connection_name
Expand Down
17 changes: 9 additions & 8 deletions modules/postgresql/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ module "database" {
for_each = toset(local.databases)
source = "./database"

gcp_project = local.gcp_project
db_name = each.value
admin_user_name = google_sql_user.admin.name
user_name = "${each.value}-user"
user_can_create_db = var.user_can_create_db
pg_instance_connection_name = google_sql_database_instance.instance.connection_name
connection_users = local.big_query_viewers
replication = local.replication
gcp_project = local.gcp_project
db_name = each.value
admin_user_name = google_sql_user.admin.name
user_name = "${each.value}-user"
user_can_create_db = var.user_can_create_db
pg_instance_connection_name = google_sql_database_instance.instance.connection_name
connection_users = local.big_query_viewers
replication = local.replication
big_query_connection_location = local.big_query_connection_location
}

provider "postgresql" {
Expand Down
28 changes: 16 additions & 12 deletions modules/postgresql/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,22 @@ variable "provision_read_replica" {
type = bool
default = false
}
variable "big_query_connection_location" {
default = "US"
}

locals {
gcp_project = var.gcp_project
vpc_name = var.vpc_name
region = var.region
instance_name = var.instance_name
destroyable = var.destroyable
highly_available = var.highly_available
tier = var.tier
max_connections = var.max_connections
databases = var.databases
big_query_viewers = var.big_query_viewers
replication = var.replication
provision_read_replica = var.provision_read_replica
gcp_project = var.gcp_project
vpc_name = var.vpc_name
region = var.region
instance_name = var.instance_name
destroyable = var.destroyable
highly_available = var.highly_available
tier = var.tier
max_connections = var.max_connections
databases = var.databases
big_query_viewers = var.big_query_viewers
replication = var.replication
provision_read_replica = var.provision_read_replica
big_query_connection_location = var.big_query_connection_location
}
Loading