UMCATODOPQUDCUN5MZIZI24GBQJXCBNMRXBH6BIKVSQNTXDKY3IQC # Build image URLbuilt_image = "${local.gcr_region}/${var.project_id}/${var.service_name}"
# Build image URL for Artifact Registrybuilt_image = "${local.artifact_registry_location}-docker.pkg.dev/${var.project_id}/${local.artifact_registry_repo}/${var.service_name}"
}# Artifact Registry repository for Docker imagesresource "google_artifact_registry_repository" "docker" {location = local.artifact_registry_locationrepository_id = local.artifact_registry_repodescription = "Docker repository for ${var.service_name}"format = "DOCKER"project = var.project_iddepends_on = [google_project_service.artifactregistry,]
# Terraform Infrastructure for Beats API## Rerunning BuildsWhile Terraform manages the Cloud Build trigger configuration, it doesn't directly rerun builds. Here are your options:### Option 1: Manual Trigger via gcloud CLI (Recommended)1. Get the trigger ID from Terraform outputs:```bashcd terraformterraform output cloud_build_trigger_id```2. Trigger the build manually:```bashgcloud builds triggers run <TRIGGER_ID> \--project=beats-476914 \--branch=main```Or use the trigger name directly:```bashgcloud builds triggers run beats-api-build \--project=beats-476914 \--branch=main```### Option 2: Push to GitHubThe trigger is configured to automatically run on pushes to the `main` branch. Simply push any commit:```bashgit push origin main```### Option 3: View Build HistoryCheck recent builds:```bashgcloud builds list --project=beats-476914 --limit=10```Or use the Makefile:```bashmake build-status```### Option 4: View Build Logs in Terminal**View logs for the latest build:**```bashmake build-logs```**Stream logs in real-time (follow mode):**```bashmake build-logs-follow```**View logs for a specific build ID:**```bashmake build-logs-id BUILD_ID=<build-id># Example:make build-logs-id BUILD_ID=7b0567e9-b97c-402b-956d-e41fc0c5d9ee```**Using gcloud directly:**```bash# Get build ID from statusBUILD_ID=$(gcloud builds list --project=beats-476914 --limit=1 --format="value(id)")# View logsgcloud builds log $BUILD_ID --project=beats-476914# Stream logs (real-time)gcloud builds log $BUILD_ID --project=beats-476914 --stream```### Option 5: Trigger via Cloud Console1. Go to [Cloud Build Triggers](https://console.cloud.google.com/cloud-build/triggers)2. Find your trigger (`beats-api-build`)3. Click "Run" → Select branch → "Run"
- '${_GCR_REGION}/${_PROJECT_ID}/${_IMAGE_NAME}:$COMMIT_SHA'- '${_GCR_REGION}/${_PROJECT_ID}/${_IMAGE_NAME}:latest'
- '${_REGISTRY_LOCATION}-docker.pkg.dev/${_PROJECT_ID}/${_REPO_NAME}/${_IMAGE_NAME}:$COMMIT_SHA'- '${_REGISTRY_LOCATION}-docker.pkg.dev/${_PROJECT_ID}/${_REPO_NAME}/${_IMAGE_NAME}:latest'
# Cloud Build targetstrigger-build:cd terraform && gcloud builds triggers run beats-api-build \--project=beats-476914 \--branch=mainbuild-status:gcloud builds list --project=beats-476914 --limit=5build-logs:@BUILD_ID=$$(gcloud builds list --project=beats-476914 --limit=1 --format="value(id)" | head -1); \if [ -z "$$BUILD_ID" ]; then \echo "No builds found"; \else \echo "Viewing logs for build: $$BUILD_ID"; \gcloud builds log $$BUILD_ID --project=beats-476914; \fibuild-logs-follow:@BUILD_ID=$$(gcloud builds list --project=beats-476914 --limit=1 --format="value(id)" | head -1); \if [ -z "$$BUILD_ID" ]; then \echo "No builds found"; \else \echo "Streaming logs for build: $$BUILD_ID (Press Ctrl+C to stop)"; \gcloud builds log $$BUILD_ID --project=beats-476914 --stream; \fibuild-logs-id:@if [ -z "$(BUILD_ID)" ]; then \echo "Usage: make build-logs-id BUILD_ID=<build-id>"; \echo "Example: make build-logs-id BUILD_ID=7b0567e9-b97c-402b-956d-e41fc0c5d9ee"; \else \gcloud builds log $(BUILD_ID) --project=beats-476914; \fibuild-trigger-id:cd terraform && terraform output cloud_build_trigger_id