How can I use template.source instead of contents in case of ConfigMap?

  1. My application is already having application.yml
  2. I am trying to use application.yml as the consul template itself. I think it would be easy migration to the vault.
  3. I declared new configmap as follows with consul hcl file as follows

    “template” = {
    “source” = “/etc/configforvault/app-resources.yml”
    “destination” = “/vault/secrets/db-creds”

  4. When I deploy the application in k8s it gives following error

2020-08-31T14:08:02.517Z [ERROR] template.server: template server failed to create: error=“failed to read template: >open /etc/configforvault/app-resources.yml: no such file or directory”
2020-08-31T14:08:02.517Z [INFO] template.server: template server stopped
2020-08-31T14:08:02.525Z [INFO] auth.handler: authentication successful, sending token to sinks

  1. I have tried creating /etc/configforvault/app-resources.yml in vault-0, vault-agent-injector-XXXXX and inside application container too, but still getting the same error.
    Can someone help me here? I am using Kubernetes and vault