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

job resource not returning deployment_id or deployment_status #104

Closed
cgbaker opened this issue May 15, 2020 · 4 comments · Fixed by #105
Closed

job resource not returning deployment_id or deployment_status #104

cgbaker opened this issue May 15, 2020 · 4 comments · Fixed by #105
Assignees
Labels
Milestone

Comments

@cgbaker
Copy link
Contributor

cgbaker commented May 15, 2020

Terraform Version

Terraform v0.12.25
Nomad Provider Version 1.4.5

Nomad Version

0.11.2

Issue

When setting a job resource with detach = false, the deployment information (if any) should be returned in deployment_id and deployment_status. This is not happening because of an improper return from deploymentStateRefreshFunc.

Furthermore, the provider was not unsetting these when detach was changed to true.

@mahsoud
Copy link

mahsoud commented May 19, 2020

@cgbaker What is the expected behaviour now for batch jobs? I started getting 404 error with the release of this fix:

resource nomad_job this {
jobspec = file("${path.module}/nomad_job.tpl")
deregister_on_destroy = true
deregister_on_id_change = true
detach = false
}

$ terraform apply
nomad_job.this: Creating...
nomad_job.this: Still creating... [10s elapsed]
nomad_job.this: Still creating... [20s elapsed]
nomad_job.this: Still creating... [30s elapsed]
Error: error waiting for job 'my-job-name' to deploy successfully: Unexpected response code: 404 (eval not found)

@cgbaker
Copy link
Contributor Author

cgbaker commented May 19, 2020 via email

@cgbaker
Copy link
Contributor Author

cgbaker commented May 19, 2020

@mahsoud, would you mind filing a new issue? I'd like to see the Terraform output with TF_LOG=8, as well as the Nomad logs.

It seems that in your case, the evaluation is being garbage collected while waiting for the deployment (it shouldn't be waiting, because batch jobs don't create deployments.) So, the provider needs to better handle the GC'd evaluation, and it needs to handle the bug around the deployment wait (which was apparently the result of a change in the Plugin SDK).

@mahsoud
Copy link

mahsoud commented May 19, 2020

the job gets executed very quickly, and yes in some cases the allocation is GC very quickly.

regardless, thank you! We'll file the issue shortly

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

Successfully merging a pull request may close this issue.

2 participants