Skip to content
Snippets Groups Projects
Commit 28f8d80b authored by Ole Langbehn's avatar Ole Langbehn
Browse files

Merge branch 'main' into production

parents d8f3821e 7e96cd86
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,7 @@ build: ...@@ -71,7 +71,7 @@ build:
- $API_BASE_URL_PATH - $API_BASE_URL_PATH
name: '${CI_JOB_NAME}_${CI_JOB_ID}' name: '${CI_JOB_NAME}_${CI_JOB_ID}'
#when: on_failure # can't do that for api base url, but can't define multiple artifacts #when: on_failure # can't do that for api base url, but can't define multiple artifacts
expire_in: 1 month expire_in: 1 week
variables: variables:
ENVIRONMENT_ID: $CI_ENVIRONMENT_SLUG ENVIRONMENT_ID: $CI_ENVIRONMENT_SLUG
script: script:
......
...@@ -23,9 +23,9 @@ data "terraform_remote_state" "okuna-common_state" { ...@@ -23,9 +23,9 @@ data "terraform_remote_state" "okuna-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
} }
locals {
default_region = data.terraform_remote_state.holi_infra_state.outputs.default_region
}
# see https://cloud.google.com/functions/docs/tutorials/terraform-pubsub # see https://cloud.google.com/functions/docs/tutorials/terraform-pubsub
locals {
# predefined environment names are staging, production, and <branchname>
environment = terraform.workspace
environment_name = trim(substr(local.environment, 0, 22), ".-") # limits the length of the name that it fits constraints google imposes for some resources, e.g. project ids
default_location = "europe-north1"
}
resource "random_id" "main" { resource "random_id" "main" {
byte_length = 2 byte_length = 2
prefix = "chat-integration-${local.environment_name}-" prefix = "chat-integration-${local.environment_name}-"
} }
resource "google_storage_bucket" "sources" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
name = random_id.main.hex
location = local.default_location
uniform_bucket_level_access = true
}
resource "google_storage_bucket_object" "function_source" { resource "google_storage_bucket_object" "function_source" {
name = "receiveEvent.zip" name = "${random_id.main.hex}/receiveEvent.zip"
bucket = google_storage_bucket.sources.name bucket = data.terraform_remote_state.holi_infra_state.outputs.gcf_sources_upload_bucket_name
source = "../../receiveEvent.zip" source = "../../receiveEvent.zip"
} }
...@@ -38,7 +24,7 @@ data "google_secret_manager_secret" "chat_admin_access_token" { ...@@ -38,7 +24,7 @@ data "google_secret_manager_secret" "chat_admin_access_token" {
resource "google_cloudfunctions2_function" "holi-chat-integration" { resource "google_cloudfunctions2_function" "holi-chat-integration" {
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 = local.default_location location = local.default_region
build_config { build_config {
runtime = "nodejs18" runtime = "nodejs18"
...@@ -46,7 +32,7 @@ resource "google_cloudfunctions2_function" "holi-chat-integration" { ...@@ -46,7 +32,7 @@ resource "google_cloudfunctions2_function" "holi-chat-integration" {
source { source {
storage_source { storage_source {
bucket = google_storage_bucket.sources.name bucket = data.terraform_remote_state.holi_infra_state.outputs.gcf_sources_upload_bucket_name
object = google_storage_bucket_object.function_source.name object = google_storage_bucket_object.function_source.name
} }
} }
......
...@@ -31,9 +31,9 @@ data "terraform_remote_state" "okuna_common_state" { ...@@ -31,9 +31,9 @@ data "terraform_remote_state" "okuna_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
} }
locals {
# predefined environment names are staging, production, and <branchname>
environment = terraform.workspace
environment_name = trim(substr(local.environment, 0, 22), ".-") # limits the length of the name that it fits constraints google imposes for some resources, e.g. project ids
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