This commit is contained in:
2025-10-29 09:30:43 -07:00
parent b1849bc111
commit f0c1edfaea
5 changed files with 60 additions and 29 deletions

41
terraform/.terraform.lock.hcl generated Normal file
View File

@@ -0,0 +1,41 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/google" {
version = "7.9.0"
hashes = [
"h1:xhzErMeJSU7hzQs7Z5MvnGG+cwZA3gxW1tGwRbGjsL8=",
"zh:09d6c241edc669a2d5a0ec20ebdc8489995e690ed7b94bb64048f23db589801b",
"zh:0aa72a11265db9201464829a31a3d834149cd0aad5bb184a46f08bef4cd56d83",
"zh:1bd349373d11ba77bcd6ba389ec94e5116ac6b1c83ea2db85e847af7948d553f",
"zh:3ca032646e2d332e48aa46be19b7c30cdadd09e066e2f7c9e0f2022fbc0e0e7a",
"zh:481a20133ad3de9ed8a5de5ade5a46fe8f9f9c9f740ad7ebb9c4d7ef914140db",
"zh:56f3b7b521fa09dacc94abca7451b075d39793a569b53ef7ebed83fb088f5035",
"zh:bde46790fb4e6bf106df0c404aa2f8361651ad9ac70f30faf4bcb55d65e7d38e",
"zh:cc8d931e1d45376a421cff84d1223571296724e263ae4ebc021e3bd76bc74b9a",
"zh:d6604e6bb61f695e631d8862490389d65895f34d0133c066a81601e5539f0fa7",
"zh:d999cf33e1dd8cb3b02a75d079e542d9f3d73bc5756b870e78dfe3bf89535bd9",
"zh:e4f38256d1f190f7e04d393ba3e247da7e12f4bcf22c2c3ce1f57b465b4ad8a3",
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
]
}
provider "registry.terraform.io/hashicorp/google-beta" {
version = "6.50.0"
constraints = "~> 6.0"
hashes = [
"h1:uxh4ME3hhSzVjmiWgA1IQqYqg25MV6FMVArHyA6Ki5o=",
"zh:18b442bd0a05321d39dda1e9e3f1bdede4e61bc2ac62cc7a67037a3864f75101",
"zh:2e387c51455862828bec923a3ec81abf63a4d998da470cf00e09003bda53d668",
"zh:3942e708fa84ebe54996086f4b1398cb747fe19cbcd0be07ace528291fb35dee",
"zh:496287dd48b34ae6197cb1f887abeafd07c33f389dbe431bb01e24846754cfdd",
"zh:6eca885419969ce5c2a706f34dce1f10bde9774757675f2d8a92d12e5a1be390",
"zh:710dbef826c3fe7f76f844dae47937e8e4c1279dd9205ec4610be04cf3327244",
"zh:777ebf44b24bfc7bdbf770dc089f1a72f143b4718fdedb8c6bd75983115a1ec2",
"zh:9c8703bba37b8c7ad857efc3513392c5a096c519397c1cb822d7612f38e4262f",
"zh:c4f1d3a73de2702277c99d5348ad6d374705bcfdd367ad964ff4cfd2cf06c281",
"zh:eca8df11af3f5a948492d5b8b5d01b4ec705aad10bc30ec1524205508ae28393",
"zh:f41e7fd5f2628e8fd6b8ea136366923858f54428d1729898925469b862c275c2",
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
]
}

View File

@@ -1,16 +1,7 @@
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}"
source = "./modules/cloud_run"
# Common variables
app_name = "rothbard-portal"
@@ -29,8 +20,7 @@ module "hosting" {
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
container_image = var.container_image
}
# Additional variables for hosting options
@@ -93,7 +83,5 @@ variable "filevine_user_id" {
# 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
}
value = module.hosting.service_url
}

View File

@@ -1,16 +1,10 @@
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
firebase = {
source = "terraform-google-modules/firebase/google"
version = "~> 13.0"
google-beta = {
source = "hashicorp/google-beta"
version = "~> 6.0"
}
}
required_version = ">= 1.0"
}
provider "google" {
@@ -18,9 +12,6 @@ provider "google" {
region = var.gcp_region
}
provider "firebase" {
project = var.gcp_project_id
}
# Firebase Project Setup
resource "google_firebase_project" "default" {
@@ -238,4 +229,4 @@ output "firebase_project_id" {
output "service_account_email" {
description = "Service account email for Flask app"
value = google_service_account.flask_app.email
}
}

View File

@@ -0,0 +1,9 @@
# Copy this file to terraform.tfvars and fill in your values
gcp_project_id = "811764775573"
domain_name = "rothbard.yourdomain.com"
# Optional: Override defaults
gcp_region = "us-central1"
firestore_location = "us-central1"
hosting_option = "cloud_run" # Options: cloud_run, app_engine, gcs
environment = "staging"