Open wallacepf opened 2 years ago
Hi @wallacepf 👋
I'm not sure how TFC4B works, but would it be possible to set the TF_LOG_PROVIDER
environment variable and reproduce the issue again?
Thanks!
Hi @wallacepf 👋
I'm not sure how TFC4B works, but would it be possible to set the
TF_LOG_PROVIDER
environment variable and reproduce the issue again?Thanks!
Of course! I'll do that during the weekend.
Here you will find the provider's debug information: https://gist.github.com/wallacepf/d7b85d8e657797a70f43dd55b6f84022
(Logging level was set to TRACE)
Seems like the variables I'm passing inside the HCL2 block aren't considered when the code runs.
Don't know if what I'm facing can be related to this: https://github.com/hashicorp/nomad/issues/11149 (The error message looks the same)
Thanks for the logs @wallacepf.
I still can't seem to reproduce it thought 🤔
Are you updating an existing job? Or maybe you set the variable
blocks after registering the job without them before?
I'm hitting something similar, if I set region
in the job spec to a non-local region, the provider will hit the inconsistent result
error. Imo it's because it doesn't check the correct region for verificatin of deployment. A fix would be to allow us to specify region
and namespace
at the nomad_job
resource level. Having multiple providers is cumbersome with aliases
Ah thanks for the extra info @MagicRB.
Unfortunately exposing these fields in the nomad_job
resource is not that doable (check https://github.com/hashicorp/terraform-provider-nomad/issues/125#issuecomment-674251130 for more details). I will try to reproduce this again and see how we can fix it.
Maybe a solution would be to detect the mismatch and give a meaningful error message. That would at least tell people how to fix it.
Hi, any updates? I encountered the same error. My terraform version is:
$ terraform version
Terraform v1.8.2
on linux_amd64
+ provider registry.terraform.io/hashicorp/nomad v1.4.20
+ provider registry.terraform.io/hashicorp/null v3.1.1
My nomad job file
variable "namespace" {
type = string
}
job "nginx-test" {
datacenters = ["dc1"]
namespace = var.namespace
constraint {
attribute = "${node.class}"
value = "common"
}
type = "system"
group "nginx" {
network {
port "http" {
static = 2987
to = 80
}
}
service {
name = "nginx"
port = "http"
}
task "nginx" {
driver = "docker"
config {
image = "nginx:1.26.0-alpine"
ports = ["http"]
}
}
}
}
terraform config
resource "nomad_job" "nginx-test" {
jobspec = file("${path.module}/jobspecs/nginx-test.hcl")
hcl2 {
enabled = true
vars = {
namespace = nomad_namespace.system-dev.name
}
}
}
Terraform Version
Nomad Version
Provider Configuration
Which values are you setting in the provider configuration?
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/wallacepf/7bf4863122f539159bd1bb4329cf67b1
Expected Behavior
Resource get deployed within specified namespace on Nomad
Actual Behavior
Error message:
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply (I'm currently using TFC4B with remote agents running on nomad)
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: