Add redshift database plugin#8299
Conversation
cb8f57a to
e009e72
Compare
There was a problem hiding this comment.
Looks like the var is misspelled, s/rotateStatents/rotateStatements/.
There was a problem hiding this comment.
A transient artifact no less https://github.com/hashicorp/vault/blob/master/plugins/database/postgresql/postgresql.go#L452
I'll fix this and PR a fix in the original codebase too. Good catch, thanks!
4a20e27 to
00726b4
Compare
tyrannosaurus-becks
left a comment
There was a problem hiding this comment.
Looks great so far! Thanks for working on this!
There was a problem hiding this comment.
| _ = tx.Rollback() | |
| tx.Rollback() |
Might as well just quietly drop the error, we do everywhere else. It would be super nice if we could log these, but alas, no logger!
There was a problem hiding this comment.
Also, I have a question about these Rollback statements. I see Rollback is called this way in the mysql plugin. Is the idea basically that if we succeeded doing the transaction, then Rollback just won't work? I'm wondering if maybe we should add a guard that's like "success" that is false by default, and then it gets set to true if the whole transaction succeeded. Then inside the deferred function, it would be like "if !success, rollback" (pseudocode).
There was a problem hiding this comment.
Might be nice to use go-multierror here to return more information about what did and didn't succeed. Commonly used in Vault.
There was a problem hiding this comment.
I'm also wondering about an edge case here. I do believe that revocations get retried if they return an error. So, if we got part way through here, returned an error below, and then a minute later restarted the logic from the top, could we get all the way down? I'm not sure we need to do somersaults to make it work - I notice the other plugins use simplistic logic, just something to think about.
There was a problem hiding this comment.
Do you have a good example of how this is implemented elsewhere? This plugin was largely inspired (and ripped off from) the PG secrets engine. If there's a simpler implementation you had in mind, would love to check it out.
There was a problem hiding this comment.
Sure, I think this is a nice example of it: https://github.com/hashicorp/vault/blob/master/plugins/database/influxdb/influxdb.go#L192
There was a problem hiding this comment.
You can also treat it like a regular error. So, for instance, in the example above, if right after the loop you wanted to do something like:
if result != nil {
return
}
... do more stuff
It would totally work like normal.
e0faa53 to
7707d80
Compare
|
Thanks @tyrannosaurus-becks - I got to everything but the final question you had in here. I force pushed over the existing commit, here's the results of testing with the latest changes: |
589ef70 to
b5588df
Compare
|
Thanks for all your work on this so far! Would you be willing to merge in master so we can also get a clean look at the build before merging? Also, I notice there are some test failures related to |
b5588df to
9d5e540
Compare
|
Awesome, thanks @tyrannosaurus-becks - added the plugin to the plugin predict test file and rebased on master. |
43a12ad to
0497375
Compare
|
Thanks for the second pass @tyrannosaurus-becks ! I added the missing Latest test results with fixes and rebase: |
tyrannosaurus-becks
left a comment
There was a problem hiding this comment.
Nice! Thank you!
7ec264d to
b95f8e3
Compare
Adds a database secrets engine for Redshift (postgres 8 compatible).
Because there are no local mocking methods available for Redshift, this plugin leverages a live Redshift cluster and enables test methods using the
VAULT_ACCpattern. See comments in header toredshift_test.gofor a full disclosure of caveats and setup instructions to run these acceptance tests.Running these tests locally: