Skip to content

Commit

Permalink
feat: allow stacks to overwrite their image URI
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeyheath committed Nov 25, 2024
1 parent 9fe9891 commit 22b6fe5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion terraform/modules/happy-service-eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ resource "kubernetes_deployment_v1" "deployment" {

container {
name = var.container_name
image = "${module.ecr.repository_url}:${var.image_tag}"
image = "${length(var.image_uri) == 0 ? module.ecr.repository_url : var.image_uri}:${var.image_tag}"
command = var.cmd
args = var.args
image_pull_policy = var.image_pull_policy
Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/happy-service-eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ variable "args" {
default = []
}

variable "image_uri" {
type = string
description = "The image URI to deploy"
default = ""
}

variable "image_tag" {
type = string
description = "The image tag to deploy"
Expand Down
1 change: 1 addition & 0 deletions terraform/modules/happy-stack-eks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ module "services" {
source = "../happy-service-eks"

image_tag = lookup(var.image_tags, each.key, var.image_tag)
image_uri = var.image_uri
tag_mutability = each.value.tag_mutability
scan_on_push = each.value.scan_on_push
container_name = each.value.name
Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/happy-stack-eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ variable "app_name" {
default = ""
}

variable "image_uri" {
type = string
description = "The URI of the docker image to deploy, defaults to the image URI created by happy"
default = ""
}

variable "image_tags" {
type = map(string)
description = "Override image tag for each docker image"
Expand Down

0 comments on commit 22b6fe5

Please sign in to comment.