vault {
  address      = "{{ vault_secrets.vault_address }}"
  token        = "{{ vault_secrets.vault_token }}"
  unwrap_token = false
}

{% if vault_secrets.nomad.enabled %}
template {
  source          = "{{ vault_root_dir }}/consul-template/nomad_client_bundle.pem.tpl"
  left_delimiter  = "[["
  right_delimiter = "]]"
  destination     = "{{ vault_root_dir }}/tls/nomad_client_bundle.pem"
  perms           = 0600
  exec {
    command = "{{ vault_root_dir }}/bin/update_nomad_cert {{ vault_secrets.nomad.token }} {{ vault_secrets.vault_token }}"
  }
}
{% endif %}
