Skip to content
Snippets Groups Projects
Commit 53b28d29 authored by Malte Finsterwalder's avatar Malte Finsterwalder
Browse files

Merge branch 'main' into production

parents c837c39d a6e8bdca
No related branches found
No related tags found
No related merge requests found
...@@ -25,11 +25,11 @@ variables: ...@@ -25,11 +25,11 @@ variables:
- $API_DOMAIN_PATH - $API_DOMAIN_PATH
name: "${CI_JOB_NAME}_${CI_JOB_ID}" name: "${CI_JOB_NAME}_${CI_JOB_ID}"
#when: on_failure #when: on_failure
expire_in: 1 month expire_in: 1 week
script: script:
- export GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_CLOUD_SERVICE_ACCOUNT} - export GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_CLOUD_SERVICE_ACCOUNT}
- terraform/environments/scripts/create-or-update-env.sh $ENVIRONMENT_ID $CI_COMMIT_SHA - terraform/environments/scripts/create-or-update-env.sh $ENVIRONMENT_ID $CI_COMMIT_SHA
- echo "$(terraform/environments/scripts/get-api-domain.sh)" > $API_DOMAIN_PATH - echo "$(terraform/environments/scripts/get-output.sh api_domain)" > $API_DOMAIN_PATH
resource_group: $ENVIRONMENT_ID # never execute terraform in parallel on the same environment resource_group: $ENVIRONMENT_ID # never execute terraform in parallel on the same environment
interruptible: false interruptible: false
......
...@@ -15,9 +15,9 @@ data "terraform_remote_state" "holi_infra_state" { ...@@ -15,9 +15,9 @@ data "terraform_remote_state" "holi_infra_state" {
# provider google including beta features # provider google including beta features
provider "google" { provider "google" {
region = "europe-north1" region = local.default_region
} }
provider "google-beta" { provider "google-beta" {
region = "europe-north1" region = local.default_region
} }
locals {
default_region = data.terraform_remote_state.holi_infra_state.outputs.default_region
}
...@@ -33,7 +33,7 @@ variable "image_tag" { ...@@ -33,7 +33,7 @@ variable "image_tag" {
resource "google_cloud_run_service" "geo_api" { resource "google_cloud_run_service" "geo_api" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
name = random_id.main.hex name = random_id.main.hex
location = "europe-north1" # finland, low CO2 emissions location = local.default_region # finland, low CO2 emissions
# https://github.com/hashicorp/terraform-provider-google/issues/5898 # https://github.com/hashicorp/terraform-provider-google/issues/5898
autogenerate_revision_name = true autogenerate_revision_name = true
......
...@@ -23,9 +23,9 @@ data "terraform_remote_state" "holi_geo_api_common_state" { ...@@ -23,9 +23,9 @@ data "terraform_remote_state" "holi_geo_api_common_state" {
# provider google including beta features # provider google including beta features
provider "google" { provider "google" {
region = "europe-north1" region = local.default_region
} }
provider "google-beta" { provider "google-beta" {
region = "europe-north1" region = local.default_region
} }
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# exit when any command fails # exit when any command fails
set -ex set -ex
cd terraform/environments > /dev/null : "${1?"Usage: $0 OUTPUT_NAME"}"
terraform output -raw api_domain cd "$(dirname "$0")"/.. > /dev/null
terraform output -raw "$1"
...@@ -5,4 +5,6 @@ locals { ...@@ -5,4 +5,6 @@ locals {
# the dns name can be at most 64 chars in total # the dns name can be at most 64 chars in total
dns_name = "${trimsuffix(substr(local.environment, 0, 34), ".-")}.${data.terraform_remote_state.holi_geo_api_common_state.outputs.dns_geo_api_domain}" dns_name = "${trimsuffix(substr(local.environment, 0, 34), ".-")}.${data.terraform_remote_state.holi_geo_api_common_state.outputs.dns_geo_api_domain}"
default_region = data.terraform_remote_state.holi_infra_state.outputs.default_region
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment