Add comprehensive Terraform infrastructure with Firebase automation
- Create Firebase project, web app, and Firestore database - Automate Firebase Authentication with email templates - Configure security rules for user data isolation - Support Cloud Run and App Engine hosting options - Add professional email templates for password reset and verification - Include deployment scripts and comprehensive documentation - Implement service accounts with minimal required permissions - Add Docker configuration for containerized deployment 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
99
terraform/deployment.tf
Normal file
99
terraform/deployment.tf
Normal file
@@ -0,0 +1,99 @@
|
||||
variable "hosting_option" {
|
||||
description = "Hosting option for the Flask app"
|
||||
type = string
|
||||
default = "cloud_run"
|
||||
validation {
|
||||
condition = contains(["cloud_run", "app_engine"], var.hosting_option)
|
||||
error_message = "The hosting_option must be one of: cloud_run, app_engine."
|
||||
}
|
||||
}
|
||||
|
||||
# Select hosting option based on variable
|
||||
module "hosting" {
|
||||
source = "./modules/${var.hosting_option}"
|
||||
|
||||
# Common variables
|
||||
app_name = "rothbard-portal"
|
||||
gcp_project_id = var.gcp_project_id
|
||||
gcp_region = var.gcp_region
|
||||
firebase_project_id = google_firebase_project.default.project
|
||||
flask_secret_key = var.flask_secret_key
|
||||
service_account_email = google_service_account.flask_app.email
|
||||
service_account_key_data = var.service_account_key_data
|
||||
|
||||
# Filevine credentials
|
||||
filevine_client_id = var.filevine_client_id
|
||||
filevine_client_secret = var.filevine_client_secret
|
||||
filevine_pat = var.filevine_pat
|
||||
filevine_org_id = var.filevine_org_id
|
||||
filevine_user_id = var.filevine_user_id
|
||||
|
||||
# Module-specific variables
|
||||
container_image = var.hosting_option == "cloud_run" ? var.container_image : null
|
||||
app_source_zip_path = var.hosting_option == "app_engine" ? var.app_source_zip_path : null
|
||||
}
|
||||
|
||||
# Additional variables for hosting options
|
||||
variable "flask_secret_key" {
|
||||
description = "Flask secret key"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "service_account_key_data" {
|
||||
description = "Service account key JSON data"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "container_image" {
|
||||
description = "Docker image for Cloud Run deployment"
|
||||
type = string
|
||||
default = "gcr.io/your-project/rothbard-portal:latest"
|
||||
}
|
||||
|
||||
variable "app_source_zip_path" {
|
||||
description = "Path to App Engine source zip"
|
||||
type = string
|
||||
default = "./app-source.zip"
|
||||
}
|
||||
|
||||
|
||||
# Filevine credentials
|
||||
variable "filevine_client_id" {
|
||||
description = "Filevine client ID"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "filevine_client_secret" {
|
||||
description = "Filevine client secret"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "filevine_pat" {
|
||||
description = "Filevine personal access token"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "filevine_org_id" {
|
||||
description = "Filevine organization ID"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "filevine_user_id" {
|
||||
description = "Filevine user ID"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
# Output hosting-specific URLs
|
||||
output "application_url" {
|
||||
description = "URL of the deployed application"
|
||||
value = var.hosting_option == "cloud_run" ? module.hosting.service_url :
|
||||
var.hosting_option == "app_engine" ? module.hosting.app_url :
|
||||
null
|
||||
}
|
||||
Reference in New Issue
Block a user