resource "jenkins_job" "this" {
  name   = var.jenkins_job_name
  folder = var.folder
  template = templatefile("${path.module}/${var.jenkins_job_type}-job.xml", {
    disabled                            = tostring(var.disabled)
    description                         = "Managed by Terraform"
    github_id                           = "8ce212f8-8e25-4d7d-9975-9d842a376a4f"
    github_api_url                      = var.github_api_url
    github_api_credentials_id           = var.github_credentials_id
    github_ssh_credentials_id           = var.github_ssh_credentials_id
    github_repository_owner             = var.github_repository_owner
    github_repository_name              = var.github_repository_name
    github_repository_http_url          = var.github_repository_http_url
    github_repository_ssh_url           = var.github_repository_ssh_url
    github_repository_branches_to_build = join(" ", var.github_repository_branches_to_build)
    jenkinsfile_path                    = var.jenkinsfile_path
  })
}
