Skip to content

Commit

Permalink
fix: missing condition in cert-manager addons for google (#2116)
Browse files Browse the repository at this point in the history
Signed-off-by: Rayane Bellazaar <[email protected]>
Co-authored-by: Rayane Bellazaar <[email protected]>
  • Loading branch information
rayanebel and Rayane Bellazaar authored Jun 23, 2023
1 parent 37c72fb commit 97a00b1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/google/cert-manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ global:
serviceAccount:
name: ${local.cert-manager.service_account_name}
annotations:
iam.gke.io/gcp-service-account: "${module.cert_manager_workload_identity.0.gcp_service_account_email}"
iam.gke.io/gcp-service-account: "${local.cert-manager.create_iam_resources && local.cert-manager.enabled ? module.cert_manager_workload_identity[0].gcp_service_account_email : ""}"
prometheus:
servicemonitor:
enabled: ${local.cert-manager.enable_monitoring}
Expand All @@ -55,7 +55,7 @@ VALUES
# This module will create a Google Service account and configure the right permissions
# to be allowed to use the workload identity on GKE.
module "cert_manager_workload_identity" {
count = local.cert-manager.create_iam_resources ? 1 : 0
count = local.cert-manager.create_iam_resources && local.cert-manager.enabled ? 1 : 0
source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity"
version = "~> v26.1.1"
name = local.cert-manager.service_account_name
Expand All @@ -70,6 +70,7 @@ module "cert_manager_workload_identity" {
# to deal with Cloud DNS. The IAM permissions will be set at the resource level (DNS zone) and not at the project
# level.
resource "google_dns_managed_zone_iam_member" "cert_manager_cloud_dns_iam_permissions" {
count = local.cert-manager.create_iam_resources && local.cert-manager.enabled ? 1 : 0
project = local.cert-manager.project_id
managed_zone = local.cert-manager.managed_zone
role = "roles/dns.admin"
Expand Down

0 comments on commit 97a00b1

Please sign in to comment.