-
Notifications
You must be signed in to change notification settings - Fork 186
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
new(redis-cli): Add support for Redis CLI with password as environment variable and command-line flags #276
base: main
Are you sure you want to change the base?
Conversation
A couple of quick notes:
Let me know what you think about this! |
Any reason not to use, in conjunction with the envvar provisioner, a command line provisioner (i.e. adding the port and host flags within the provisioner itself). The entire provisioner should be the equivalent of:
|
@hculea, that's a great suggestion, thank you! So, today's the first time I properly dived into the provisioner SDK and I see that it's possible to provision two types of credentials (environment variables and command-line flags, in this case) in a single provisioner. The current shell plugin supports this behavior with a new Examples to test with:
While Redis CLI supports multiple command line flags, I have worked here with the assumption that host and port are minimum-required flags. If the user supplies additional flags, they'll be used properly. Example:
Also, if the user decides to use a custom value for the host and port, as opposed to the value we have on the 1Password item, that shouldn't be a problem either. The flag value entered by the user will be used and the one from the 1Password item be skipped. Let me know what you think of this setup! |
For some additional context on why this new function is needed,
Redis CLI expects the flags to be immediately after the executable name, thus the new function |
Couple of additional notes for all reviewers:
For the near future:
As we can see here, these environment variables vary between providers, and most importantly, vary from the open source redis software, which offers only REDISCLI_AUTH. So, we will need to think of how to best-approach Terraform compatibility. In the meantime, I propose we push forward the current version, as there's significant value for Upstash and redis.com cloud users. |
I did a functional test with local docker + ACL and it worked beautifully. |
Updated thought process:
So, the updated credentials are as follows:
New testing instructions, which can be tested only by internal contributors:
Sample main.tf file to test with:
|
Those failing validation checks are tracked internally now. I think we'll need to discuss and conclude how we handle those as well before we can merge this PR. |
Regarding the merge conflict, I am going to rebase with |
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.
This is getting very close! Nice work @arunsathiya !
This is the failing check: We conceptually no longer need this. I have also confirmed that we don't need it from a technical point of view by testing the latest version of redis plugin with the latest cli. @arunsathiya feel free to remove it. |
@AndyTitu Appreciate the feedback! I built One example is, redis handles So, in fe969f8, I have taken a different approach: Let me know what you think of this! |
…ed\, because multi-credential support is beginning to be possible
…ter the executable name, or at the end, because specific index provisioning breaks some cases
…unction to RedisCloudAPIKey
… seem consistent, at least in the case of user key
…ause by default, a redis server does not require an username or password to connect to it.
…ately after the executable name, or at the end, because specific index provisioning breaks some cases" This reverts commit fe969f8.
…isioner, build a safeguard to ensure that arguments are not provisioned out of bounds.
…arguments provision that injects arguments at the first index. This works along with the environment variable provisioner as a chained provision. This is a temporary arrangement until the Arguments Provision is reintroduced at the SDK-level.
…n names: Account Key and User Key. Credential name remains API Key
…lt value is false
…ProvisionAt param is removed
Co-authored-by: Floris van der Grinten <floris.vandergrinten@agilebits.com>
…nction from RedisCloudAPIKey to APIKey
…re defined\, because multi-credential support is beginning to be possible" This reverts commit 0100c22.
…lows for more control over the order in which the arguments are provisioned
…line arguments but it's not working just yet due to slice range issues
…rors, but this is not necessarily a concern in redis-cli because we always provision at index 1 and redis-cli is the minimum required command
…h 1Password-stored secrets to provision
Been a while since I last worked on this. Some progress notes and testing instructions below! New changes:
Testing instructions:
|
Overview
This PR adds support for redis-cli. The password for connecting to the redis server can be set as an environment variable and it'll be used by the shell plugin.
Type of change
Related Issue(s)
How To Test
make redis/build
op plugin init redis-cli
. Set the password as a 1Password field item.redis-cli -h host-address-here.com -p port-number-here PING
PONG
Changelog
Add support for Redis CLI with environment variable-based provisioning.