I have a pretty simple kubernetes_job like this:
resource "kubernetes_job" "demo" {
metadata {
name = "demo"
}
spec {
template {
metadata {}
spec {
container {
name = "pi"
image = "perl"
command = ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
}
restart_policy = "Never"
}
}
backoff_limit = 1
}
wait_for_completion = true
timeouts {
create = "2m"
update = "2m"
}
}
Which is supposed to just get completed once and be done with it... which it does, but a re-occurring error keeps appearing:
Error: Cycle: module.kubernetes_job.demo
I have found that the job in Kubernetes is listed as "complete" but the respective pod has disappeared, so to "fix" this, I have to delete the job and terraform plan and apply again.
Is there a way to have the job (even though it says completed), start a new pod if the existing one disappears without this cycle error?