This document defines the real deployment architecture for the FinOps Assessment Platform based on the current Terraform baseline in infra/terraform/.
- Implemented: Terraform provisions one Cloud Run v2 service (
google_cloud_run_v2_service.runtime) using a prebuilt container image (container_image). - Implemented: Runtime sizing and execution controls are configurable (
container_concurrency,container_timeout_seconds,container_cpu,container_memory). - Planned: Real deployment validation in a non-placeholder GCP project using environment tfvars.
- Implemented boundary: Terraform expects an image URI and deploys it to Cloud Run.
- Not yet implemented in Terraform: Artifact Registry repository creation, image build, and image push pipeline.
- Operational flow (current model): build image externally -> push to Artifact Registry externally -> pass tagged
container_imageinto Terraform -> Cloud Run pulls image at deploy time.
- Implemented: Dedicated runtime service account (
google_service_account.runtime) attached to Cloud Run. - Implemented: Optional dedicated scheduler invoker service account (
google_service_account.scheduler_invoker) when scheduler is enabled. - Implemented: Scheduler invoker receives only
roles/run.invokeron the Cloud Run service.
- Implemented: Project-scoped read-only scanner roles are granted to runtime identity for explicit
target_projects:roles/compute.viewerroles/monitoring.viewerroles/container.viewerroles/cloudsql.viewerroles/storage.viewer
- Implemented: Org mode adds discovery-only role
roles/resourcemanager.projectViewerat org level. - Implemented limitation: Org mode does not auto-propagate scanner roles to discovered projects.
- Implemented separation: Runtime identity is distinct from the human/operator identity running Terraform.
- Planned operational requirement: Operator/deployer permissions remain outside this Terraform module and must be managed separately.
- Implemented:
variables.tfdefines validated inputs for project, region, runtime behavior, IAM scope, scheduler, and optional secret wiring. - Implemented:
env/dev.tfvars,env/staging.tfvars, andenv/prod.tfvarsprovide per-environment values and defaults. - Implemented: Contract checks enforce scope consistency:
target_scope_mode=projectrequires non-emptytarget_projectstarget_scope_mode=orgrequirestarget_org_id
Implemented in google_cloud_run_v2_service.runtime:
environment->ENVIRONMENTexecution_mode->EXECUTION_MODEtarget_scope_mode->TARGET_SCOPE_MODEtarget_projects->TARGET_PROJECTS(comma-separated)target_org_id->TARGET_ORG_IDlog_level->LOG_LEVELenable_artifact_storage->ENABLE_ARTIFACT_STORAGEenable_scheduler->ENABLE_SCHEDULERruntime_secret_env(optional) -> dynamic secret-backed env vars from Secret Manager
- Implemented: Operator-driven execution is primary (manual Terraform run + runtime endpoint invocation).
- Implemented: Cloud Run endpoint is deploy-time output and supports on-demand execution.
- Implemented optional extension: Cloud Scheduler can trigger the same Cloud Run path when
enable_scheduler=true. - Not yet implemented: CI/CD-triggered deployment/execution orchestration.
- Implemented as optional infrastructure branch only.
- Environment intent currently encoded in tfvars:
dev: scheduler disabledstaging: scheduler disabledprod: scheduler enabled
Implemented in outputs.tf:
cloud_run_service_namecloud_run_service_uriruntime_service_account_email
- Implemented usage: Operators use outputs for endpoint invocation and identity verification after apply.
- Planned/operational: Runtime logs and run diagnostics are consumed from GCP logging during deployment validation.
- Implemented: Cloud Run runtime, runtime IAM, optional scheduler wiring, optional Secret Manager access wiring.
- Not yet implemented in current Terraform baseline: Demo waste resources (for example stopped VM, unattached disk, unused IP) are not provisioned in
infra/terraform. - Planned for Phase 7 scope: Demo validation environment should be handled explicitly and separately from runtime deployment resources.
- Implemented now: Core deployment baseline for running the platform on Cloud Run with read-only scanning IAM.
- Planned next: Replace placeholders, apply in real project(s), and perform Phase 7 real deployment validation.
- Not yet implemented: Artifact Registry provisioning/build pipeline, demo validation infra resources, CI/CD automation, and multi-region topology.