Weird consul connect port behavior with nomad

Hello, I’m very (very) new to consul as well as nomad. I was having some trouble wrapping my head around this.
I have this port under the network stanza of my task

port "tsa" {
  to = "2222"
}

and had this service

service {
  name = "concourse-tsa"
  port = "tsa"
}

I wanted to add this service to the consul connect service mesh so I changed it to

service {
  name = "concourse-tsa"
  port = "tsa"
  connect {
    sidecar_services {}
  }
}

But it didn’t work as intended. What worked was

service {
  name = "concourse-tsa"
-  port = "tsa"
+  port = "2222"
  connect {
    sidecar_services {}
  }
}

Is this the intended behavior? Or am I missing something?

1 Like

Hi @natto1784,

This appears to be intentional. The Nomad docs need to be updated to reflect that a numeric port value must be provided when you are also configuring the connect.sidecar_service stanza. See connect/docs: clarify service.port for each context · Issue #10677 · hashicorp/nomad · GitHub.