diff --git a/CHANGELOG b/CHANGELOG index 7231fa7feab248980d5ad12460bb11b04533d1ee..808eae0f6fb38e7b1850b02df773b1e47bdf8d20 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [8.1.0] - 2023-07-04 + +### Added + +- Added new variable `pre_deploy_job_environment_variables` to optionally override `environment_variables` for pre-deploy jobs. + ## [8.0.0] - 2023-06-16 ### Added diff --git a/locals.tf b/locals.tf index bdaba8fad803a6adcc279bd377b7580c3519a381..3ca469d0bfc3da460523931c1dc3195a17b9a106 100644 --- a/locals.tf +++ b/locals.tf @@ -36,6 +36,8 @@ locals { pre_deploy_job_image_name = var.pre_deploy_job_image_name == null ? var.image_name : var.pre_deploy_job_image_name + pre_deploy_job_environment_variables = var.pre_deploy_job_environment_variables == null ? var.environment_variables : var.pre_deploy_job_environment_variables + # Certain ingress styles imply that we disallow external access to the base Cloud Run service. webapp_allowed_ingress = lookup({ load-balancer = "internal-and-cloud-load-balancing" diff --git a/main.tf b/main.tf index a81814536465ccea1983430d62a4451d33254e9e..b0eadf31294ef2543eb76bc0bd2e0ba4fff128e1 100644 --- a/main.tf +++ b/main.tf @@ -334,7 +334,7 @@ resource "google_cloud_run_v2_job" "pre_deploy" { args = var.pre_deploy_job_args dynamic "env" { - for_each = var.environment_variables + for_each = local.pre_deploy_job_environment_variables content { name = env.key diff --git a/variables.tf b/variables.tf index eb2bc0441b7c11b1801a3340e787c5064698454c..880a15813b45e00079b73f1ad26cf49680394666 100644 --- a/variables.tf +++ b/variables.tf @@ -70,6 +70,16 @@ variable "pre_deploy_job_args" { default = null } +variable "pre_deploy_job_environment_variables" { + description = <<EOI +Environment variables which can be set on the pre-deploy Cloud Run job. Map from name to value. +By default the var.environment_variables is used +(see locals.tf). +EOI + type = map(string) + default = null +} + variable "grant_sql_client_role_to_webapp_sa" { description = <<EOI When set to true the 'roles/cloudsql.client' role will be granted to the