Skip to content

Commit ec4f1a2

Browse files
author
Eugene Malihins
committed
support image_pull_secrets for k8s SA in workload identity module
1 parent c3e1a8d commit ec4f1a2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

modules/workload-identity/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ resource "kubernetes_service_account" "main" {
5353
count = var.use_existing_k8s_sa ? 0 : 1
5454

5555
automount_service_account_token = var.automount_service_account_token
56+
57+
dynamic "image_pull_secret" {
58+
for_each = var.image_pull_secrets
59+
60+
content {
61+
name = image_pull_secret.value
62+
}
63+
}
64+
5665
metadata {
5766
name = local.k8s_given_name
5867
namespace = var.namespace

modules/workload-identity/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ variable "automount_service_account_token" {
8484
default = false
8585
}
8686

87+
variable "image_pull_secrets" {
88+
description = "A list of references to secrets in the same namespace to use for pulling any images in pods that reference this Service Account"
89+
type = list(string)
90+
default = []
91+
}
92+
8793
variable "roles" {
8894
description = "A list of roles to be added to the created service account"
8995
type = list(string)

0 commit comments

Comments
 (0)