Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource Name with hyphen (-) is giving error invalid memory address or nil pointer #89

Open
ashwanisharmamw opened this issue May 22, 2023 · 8 comments

Comments

@ashwanisharmamw
Copy link

I have secrets name with Hyphen in the name and i tired to pull these using index and getting nil pointer error

workers:

  resources:
  - kind: secret
  name: pem-test
  vaultBaseURL: https://test-key-vault.vault.azure.net/
  sinks:
  - path: ./test.secret
  template: '{{ index .Secrets "pem-test.Value" }}'
@ashwanisharmamw ashwanisharmamw changed the title Resource with hyphen (-) is giving error invalid memory address or nil pointer Resource Name with hyphen (-) is giving error invalid memory address or nil pointer May 23, 2023
@ashwanisharmamw
Copy link
Author

@vickicello - Can you please help on this issue

@vickicello
Copy link
Contributor

@ashwanisharmamw The .Value syntax unfortunately does not work on secret names that have special characters (like hyphens). One easy workaround is to create an alias for your secret name like this:

  resources:
  - kind: secret
    name: pem-test
    alias: pemtest
    vaultBaseURL: https://test-key-vault.vault.azure.net/
  sinks:
  - path: ./test.secret
    template: '{{ index .Secrets.pemtest.Value }}'

Hopefully using an alias will work for you.

@ashwanisharmamw
Copy link
Author

Thanks @vickicello for your quick response, I will try this option and let you know, Just want to check is this alias works with all-secrets, I have dynamic list of secrets to get from the key vault for different service and want it use the all-secrets option

@vickicello
Copy link
Contributor

Based on the readme it looks like alias would only work with key, cert, and secret resource kinds.

@ashwanisharmamw
Copy link
Author

Thanks for the clarification.

@ashwani087
Copy link

@vickicello - Can you please share the example to read the pem file from the keys

@vickicello
Copy link
Contributor

There are some examples for extracting pem files in the README: https://github.com/covermymeds/azure-key-vault-agent#ssl-cert--private-key

@ashwani087
Copy link

Ok thanks @vickicello

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants