hashicorp / levant

An open source templating and deployment tool for HashiCorp Nomad jobs
Mozilla Public License 2.0
829 stars 125 forks source link

Render consulKeyOrDefault: Unexpected Response Code: 403 #403

Closed ponvenkates closed 3 years ago

ponvenkates commented 3 years ago

Hi Team, We are using Hashicorp Nomad, consul and vault for our control plane setup. I am trying to render nomad job file based on a Consul KV. Below given is my template. [[ with $backup := consulKeyOrDefault "/postgres/postgres-backup" "" ]] [[ if or $backup.nfs_host false ]] mounts = [ { type = "volume" target = "/backup" readonly = false volume_options { driver_config { options = { type = "nfs" o = "addr=[[ $backup.nfs_host ]],nolock,soft,rw" device = ":[[ $backup.nfs_path ]]" } } } } ] [[ end ]] [[ end ]]

When i run levant render, I get Unexpected Response code: 403 error. I am guessing this issue is to do with the ACL token for Consul access, however I am not able to find any documentation or variable available for passing Consul ACL token. I tried setting an environment variable "CONSUL_TOKEN" which usually works with consul commands, but levant isn't picking the ACL from the environment variable. Any help here is much appreciated.

ponvenkates commented 3 years ago

Apologies. Little premature on my end. Found the token configuration here and it works. CONSUL_HTTP_TOKEN was the one I was looking for.