diff --git a/terraform/environments/deployment.tf b/terraform/environments/deployment.tf index 8cdb1449913d1fa1bd180afd83f21eb970dd6ec2..c5dd9424c664506c89633bf7a4f11452ee98aa35 100644 --- a/terraform/environments/deployment.tf +++ b/terraform/environments/deployment.tf @@ -30,8 +30,8 @@ variable "image_tag" { } resource "google_cloud_run_service" "events" { - project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id - name = random_id.main.hex + project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id + name = random_id.main.hex location = local.default_region # https://github.com/hashicorp/terraform-provider-google/issues/5898 autogenerate_revision_name = true @@ -63,6 +63,14 @@ resource "google_cloud_run_service" "events" { name = "ENVIRONMENT" value = local.environment } + env { + name = "IMAGE_PROXY_BASE_URL" + value = local.environment == "production" ? "https://images.holi.social" : "https://dev-images.holi.social" + } + env { + name = "GEO_API_ENDPOINT_URL" + value = data.terraform_remote_state.holi_geo_api_environments_state.outputs.api_endpoint_url + } resources { limits = { # cpu can only be scaled down to 1000m as long as container_concurrency is set to != 1 @@ -80,7 +88,7 @@ resource "google_cloud_run_service" "events" { # template annotations: https://cloud.google.com/run/docs/reference/rpc/google.cloud.run.v1#revisiontemplate metadata { annotations = { - "autoscaling.knative.dev/minScale" = local.environment == "production" ? "1" : "0" + "autoscaling.knative.dev/minScale" = local.environment == "production" ? "1" : "0" "autoscaling.knative.dev/maxScale" = local.environment == "production" ? "2" : "1" # Use the VPC Connector "run.googleapis.com/vpc-access-connector" = data.terraform_remote_state.holi_infra_state.outputs.vpc_access_connector_name diff --git a/terraform/environments/init.tf b/terraform/environments/init.tf index b5b2ede7f1546fc14add05bc636d0b10f59814e5..c391bb4e7298e9e7096e25aaca4d1b11300b19f0 100644 --- a/terraform/environments/init.tf +++ b/terraform/environments/init.tf @@ -21,6 +21,15 @@ data "terraform_remote_state" "holi_events_common_state" { } } +data "terraform_remote_state" "holi_geo_api_environments_state" { + backend = "gcs" + workspace = terraform.workspace == "production" ? "production" : "staging" + config = { + bucket = "holi-shared-terraform-state" + prefix = "geo-api-environments" + } +} + # provider google including beta features provider "google" { region = local.default_region