Skip to content
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
10 changes: 9 additions & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,22 @@ resource "digitalocean_database_cluster" "postgres" {
tags = var.tags
}

# Database firewall - only allow App Platform
# Database firewall - allow App Platform apps
resource "digitalocean_database_firewall" "postgres_fw" {
cluster_id = digitalocean_database_cluster.postgres.id

rule {
type = "app"
value = digitalocean_app.mlb_stats.id
}

dynamic "rule" {
for_each = var.additional_trusted_sources
content {
type = rule.value.type
value = rule.value.value
}
}
}

# App Platform Application
Expand Down
10 changes: 10 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ variable "ga_measurement_id" {
description = "Google Analytics 4 Measurement ID"
}

# Additional Trusted Sources (for shared database access)
variable "additional_trusted_sources" {
description = "Additional sources that need access to the database. Each entry needs a type (app, droplet, k8s, ip_addr, tag) and value."
type = list(object({
type = string
value = string
}))
default = []
}

# Custom Domain
variable "custom_domain" {
description = "Custom domain for the application (e.g., stats.cartergrove.me)"
Expand Down
Loading