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

[FEAT] Add Option: ignoreKeyNotFound #551

Open
xsfa opened this issue May 13, 2024 · 3 comments
Open

[FEAT] Add Option: ignoreKeyNotFound #551

xsfa opened this issue May 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@xsfa
Copy link

xsfa commented May 13, 2024

The Problem

When programmatically passing in vault keys, if the key does not exist I would like the option for the resulting value to be a null or default value.

Proposed Solution

- name: Import Secrets
  uses: actions/[email protected]
  with:
    url: ${{ env.url }}
    method: approle
    roleId: ${{ env.role_id }}
    secretId: ${{ env.secret_id }}
    caCertificate: ${{ secrets.vault_ca_cert }}
    ignoreKeyNotFound: true # ***
    defaultValue: null # *** or 'string', defaults to null
    secrets: |
      ${{ env.secret_path }} credentials.${{ env.PREFIX }}.username | username ;
      ${{ env.secret_path }} credentials.${{ env.PREFIX }}.password | password ;

Explored Alternatives

  • Setting a default value to all possible keys IN VAULT
  • Conditionally calling vault-action

Both approaches are messy/hacky and not scalable

@xsfa xsfa added the enhancement New feature or request label May 13, 2024
@xsfa
Copy link
Author

xsfa commented May 13, 2024

I looked through the code and have an idea on how to implement this, will try to open a PR in the coming days.

@fairclothjm
Copy link
Contributor

@xsfa Are you aware of the ignoreNotFound option? Does this solve the issue for you?

@xsfa
Copy link
Author

xsfa commented May 14, 2024

@xsfa Are you aware of the ignoreNotFound option? Does this solve the issue for you?

@fairclothjm I tried it, I believe this option only handles cases where the secret is not found, not when a key within the secret is not found.

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

No branches or pull requests

2 participants