-
Notifications
You must be signed in to change notification settings - Fork 50
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
use openAppSecrets instead of list+Open secret in DataSourceVaultSecr… #826
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, this looks good me!
|
||
var secrets *secret_service.OpenAppSecretsOK | ||
var err error | ||
for attempt := 0; attempt < retryCount; attempt++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I know this bloats code, but to provide an abstraction with type casting to all known vault secrets input/output types seems poor for readability to me personally, but we can always consider doing that. also, should be a separate ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the type casting, which I think I tried to avoid it. The type is being examined in the body of this function. But, then the generic part of retry logic is refactored.
I considered working on the refactoring part in another ticket, but, the change I believe is small enough to include it here.
Not seeing the test |
I provided a snippet of that. I just used that for local testing. |
If you want this test persisted, then we should be able to extend our acceptance tests easily. |
So, the |
Ahh, understood. Existing test is fine then. |
Can't approve as it's in draft. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubber stamping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🛠️ Description
Addresses: https://hashicorp.atlassian.net/browse/VAULT-26495
We currently call ListAppSecrets, iterate over each secret and individually invoke OpenAppSecret here. This is both inefficient for us and causes additional API usage for the clients.
I think switching to OpenAppSecrets for this data source would be best.
🏗️ Acceptance tests
Output from acceptance testing:
To test this, I also created the following helper function:
Added the above function to
TestAcc_dataSourceVaultSecretsApp
test on line 97 (which is after the test creates two secrets). The test passes and generates the following DD log: