Skip to content

add the fields "serviceAccountName" and "serviceAccount" in the "kubernetes_cron_job" resource. #2070

@aloosnetmatch

Description

@aloosnetmatch

Description

I want to use my own serviceaccount to run a Cronjob in Kubernetes.
Now it looks like the cronjob uses the "default" account from the namespace it's located in.

add the fields "serviceAccountName" and "serviceAccount" in the "kubernetes_cron_job" resource.

Potential Terraform Configuration

resource "kubernetes_cron_job" "example" {
  metadata {
    name      = "${var.application}-up"
    namespace = var.aks_namespace
    labels = {
      app       = "${var.application}-up"
      az_env    = var.environment
    }
  }
  spec {
    concurrency_policy            = "Replace"
    failed_jobs_history_limit     = 5
    schedule                      = "08 08 * * *"
    starting_deadline_seconds     = 10
    successful_jobs_history_limit = 10
    **serviceAccountName: sa-example
    serviceAccount: sa-example**
    job_template {
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions