FAQ | This is a LIVE service | Changelog

Commit c284e14b authored by Arun Patel's avatar Arun Patel Committed by Wajdi Hajji
Browse files

Added inputs for new and any existing images to deploy

parent b28c5526
......@@ -4,6 +4,11 @@ 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).
## [4.0.0] - 2021-06-29
### Changed
- Added explicit image_name to deploy. Requires existing_image_name to be valid
in the case of an also empty image_name, to avoid mis-deploying hello:latest.
## [3.1.1] - 2021-06-16
### Changed
- Surface the alerting success threshold variable from the monitoring module.
......@@ -175,3 +175,24 @@ module "webapp" {
## Passing Image Names to the Module
Originally, the module did not deploy images except on the very first use (using
Currently, deploy the image from `image_name` if specified, otherwise keep the
current image, if that doesn't exist fall-back to the "hello" image.
The name of the currently deployed image needs to be sourced outside of
this module and supplied as `existing_image_name` to prevent a cyclic dependency
problem. This can be extracted from an existing deployment and included in the
root module with:
existing_image_name = (
data.google_cloud_run_service.webapp.template != null ?
data.google_cloud_run_service.webapp.template[0].spec[0].containers[0].image :
......@@ -111,9 +111,11 @@ resource "google_cloud_run_service" "webapp" {
service_account_name = google_service_account.webapp.email
containers {
# This is a bootstrap container image. The real image is deployed by
# Gitlab CI.
image = "gcr.io/cloudrun/hello:latest"
image = coalesce(
resources {
limits = {
......@@ -177,11 +179,6 @@ resource "google_cloud_run_service" "webapp" {
lifecycle {
ignore_changes = [
# Which image is deployed to the container will be updated by GitLab CI.
# As such, don't view changes to the container image as requiring the
# resource be updated.
# Some common annotations which we don't care about.
......@@ -303,3 +303,21 @@ variable "secrets_envars" {
variable "image_name" {
type = string
default = ""
description = <<-EOL
The docker image that will be deployed. If unset, the value of existing_image_name
is preferred.
variable "existing_image_name" {
type = string
default = ""
description = <<-EOL
The image currently deployed, which needs to be passed into this module to
avoid a cyclic dependency. If unset, the hello container will be deployed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment