Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes_job_v1 does not support suspend field #2631

Open
davgia opened this issue Nov 22, 2024 · 0 comments
Open

kubernetes_job_v1 does not support suspend field #2631

davgia opened this issue Nov 22, 2024 · 0 comments
Assignees
Labels

Comments

@davgia
Copy link

davgia commented Nov 22, 2024

I am creating this new issue because the original one has been closed without resolving it (#1739).

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.9.6
Kubernetes provider version: v2.32.0
Kubernetes version: v1.30.6-eks-7f9249a

Affected Resource(s)

  • kubernetes_job_v1

Terraform Configuration Files

resource "kubernetes_job_v1" "restore_db" {
  metadata {
    name      = "restore-db"
    namespace = data.kubernetes_namespace_v1.database_management.id
  }

  spec {
    suspend = true # <--- this field does not exist
    backoff_limit = 1
    template {
      metadata {
        labels = local.restore_common_labels
      }
      spec {
        restart_policy = "Never"
        container {
          name  = "database-restorer"
          image = "mcr.microsoft.com/mssql-tools"
          command = [
            "/bin/bash",
            "-c"
          ]
          args = [
            "/opt/mssql-tools/bin/sqlcmd -V16 -b -S $DATABASE_INSTANCE -U $MASTER_USERNAME -i /data/restore_db.sql"
          ]
          env {
            name  = "DATABASE_INSTANCE"
            value = "${data.aws_db_instance.target.address},${data.aws_db_instance.target.db_instance_port}"
          }
          env {
            name  = "MASTER_USERNAME"
            value = local.rds_master_username
          }
          env_from {
            secret_ref {
              name = kubernetes_secret_v1.restore_db.metadata.0.name
            }
          }
          volume_mount {
            name       = "script-volume"
            mount_path = "/data"
          }
        }
        volume {
          name = "script-volume"
          config_map {
            name = kubernetes_config_map_v1.restore_db.metadata.0.name
          }
        }
      }
    }
  }
}

Output

│ Error: Unsupported argument
│
│   on db_restore.tf line 53, in resource "kubernetes_job_v1" "restore_db":
│   53:     suspend = true
│
│ An argument named "suspend" is not expected here.

Steps to Reproduce

  1. terraform validate

Expected Behavior

What should have happened?

Kubernetes job spec support the suspend field since v1.21, I should be able to specify the suspend field in the kubernetes_job_v1 resource too.

Actual Behavior

What actually happened?
I cannot specify the suspend field, terraform rejects it. It is strange because kubernetes_cronjob_v1 supports it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants