Skip to content

Refactor Naming Convention and Fix Deployment Errors#9

Merged
benjamin-747 merged 3 commits intogitmono-dev:mainfrom
WiedersehenM:feat/gcp-cloudrun-lb-certmanager
Feb 11, 2026
Merged

Refactor Naming Convention and Fix Deployment Errors#9
benjamin-747 merged 3 commits intogitmono-dev:mainfrom
WiedersehenM:feat/gcp-cloudrun-lb-certmanager

Conversation

@WiedersehenM
Copy link
Contributor

Summary

This PR standardizes the GCP Terraform deployment naming convention and addresses several technical issues encountered during initial deployment. All resources are now dynamically named using the ${var.app_name} prefix to ensure consistency and fulfill project requirements. Additionally, it fixes critical errors in Filestore networking, Monitoring metrics, and Cloud Run port configurations.

Key Changes

Naming Convention Refactor

  • Dynamic Naming: Implemented centralized naming logic in main.tf locals. Resources now automatically prefix themselves with ${var.app_name} (e.g., mega-vpc, mega-backend-bs).
  • Variable Cleanup: Removed legacy name_prefix and redundant lb_domain variables. Unified all domain-related configurations under base_domain.
  • Config Update: Updated terraform.tfvars.example to reflect the new <app_name>-* naming style and added instructions for synchronized configuration.

Critical Bug Fixes

  • Filestore Connectivity: Fixed the network project mismatch error by using project-qualified network ID references for Filestore instances.
  • Monitoring Alerts: Corrected google_monitoring_alert_policy by switching the aligner for Gauge metrics from ALIGN_RATE to ALIGN_MEAN (with REDUCE_MAX), preventing API validation failures.
  • Cloud Run Ports: Explicitly configured container ports in the cloud_run module (Backend: 8000, UI: 3000) to resolve container startup timeouts.

…deployment errors

- Standardize all resource naming to strictly use  as a prefix (e.g., mega-vpc, mega-backend)
- Move naming logic to locals in main.tf and set default resource name variables to empty strings
- Fix Filestore network project mismatch by using project-qualified network ID references
- Correct Monitoring alert policies by switching Gauge metrics from ALIGN_RATE to ALIGN_MEAN
- Ensure Cloud Run services use correct container ports (8000 for backend, 3000 for UI)
- Remove legacy name_prefix and lb_domain variables, unifying domain config under base_domain
- Update terraform.tfvars.example to reflect the new naming convention and setup flow

Signed-off-by: Hongze Gao <15101764808@163.com>
Comment on lines -39 to +45
cloud_sql_instance_name = "mega-prod-db"
cloud_sql_instance_name = "mega-db"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该不需要这个配置,直接用app_name 拼接 db 就行

vpc_connector_cidr = "10.8.0.0/28"

# Redis (Memorystore)
redis_instance_name = "mega-prod-redis"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,用app_name 拼接 redis

redis_memory_size_gb = 1

# Filestore
filestore_instance_name = "mega-fs"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,用app_name 拼接 fs

- Implement "Convention over Configuration" by strictly enforcing resource naming prefixed with app_name in main.tf locals
- Remove redundant resource name variables from variables.tf (VPC, DB, Redis, Filestore, Cloud Run service names, etc.)
- Add Cloud Run service definitions for orion-server and campsite
- Fix duplicate output definitions for app_cloud_run_url and ui_cloud_run_url
- Fix invalid variable interpolation in variable descriptions within variables.tf
- Correct Filestore network reference to use network_id, resolving project mismatch errors
- Update terraform.tfvars.example to reflect the simplified configuration and new services

Signed-off-by: Hongze Gao <15101764808@163.com>
benjamin-747
benjamin-747 previously approved these changes Feb 11, 2026
… naming

Signed-off-by: Hongze Gao <15101764808@163.com>
@benjamin-747 benjamin-747 merged commit 15642d2 into gitmono-dev:main Feb 11, 2026
1 check failed
@WiedersehenM WiedersehenM deleted the feat/gcp-cloudrun-lb-certmanager branch February 14, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants