This commit is contained in:
Jun-te Kim 2026-03-11 18:00:00 +00:00
parent d45958843b
commit 5d933b73f6
3 changed files with 39 additions and 6 deletions

View file

@ -68,11 +68,43 @@ resource "null_resource" "pip_install" {
}
}
############################################
# Create deployment zip
############################################
data "archive_file" "fastapi_zip" {
type = "zip"
source_dir = "${path.root}/../../../../"
output_path = "${path.module}/fastapi_lambda_${var.stage}.zip"
excludes = [
"**/__pycache__/**",
"**/*.pyc",
"**/.pytest_cache/**",
"**/tests/**",
"**/.git/**",
"**/.terraform/**",
"**/node_modules/**",
"**/.env*",
"**/*.xlsx",
"**/*.pdf"
]
depends_on = [null_resource.pip_install]
}
############################################
# Upload zip to S3
############################################
resource "aws_s3_object" "fastapi_zip" {
bucket = "ara-fast-api-terraform-state"
key = "fastapi-lambda/${var.stage}/fastapi_lambda_${var.stage}_${data.archive_file.fastapi_zip.output_base64sha256}.zip"
source = data.archive_file.fastapi_zip.output_path
etag = filemd5(data.archive_file.fastapi_zip.output_path)
}
############################################
# FastAPI Lambda + API Gateway
############################################
module "fastapi" {
depends_on = [null_resource.pip_install]
depends_on = [aws_s3_object.fastapi_zip]
source = "../../modules/lambda_with_api_gateway"
name = "fastapi"

View file

@ -550,7 +550,8 @@ module "fast_api_s3_read_and_write" {
"arn:aws:s3:::${module.retrofit_heat_predictions.bucket_name}",
"arn:aws:s3:::${module.retrofit_heating_kwh_predictions.bucket_name}",
"arn:aws:s3:::${module.retrofit_hotwater_kwh_predictions.bucket_name}",
"arn:aws:s3:::${module.retrofit_energy_assessments.bucket_name}"
"arn:aws:s3:::${module.retrofit_energy_assessments.bucket_name}",
"arn:aws:s3:::ara-fast-api-terraform-state"
]
actions = ["s3:GetObject", "s3:ListBucket"]
resource_paths = ["/*"]

View file

@ -28,13 +28,13 @@ from sqlalchemy import func
# PORTFOLIO_ID = 206
# SCENARIOS = [389]
PORTFOLIO_ID = 581
SCENARIOS = [1124]
PORTFOLIO_ID = 625
SCENARIOS = [1134]
scenario_names = {
1124: "EPC C - Solar Focused",
1134: "EPC C",
}
project_name = "WCHG EPC D rated properties"
project_name = "Fortem Solutions - Ara-Software-Partnership"
def get_data(portfolio_id, scenario_ids):