Add ability to pass a token value when creating a new token
Proposal:
Add an option to influx auth create so that we can give it a pre-defined token value.
Note: a token option already exists but is is only used to authenticate the command, not to define the new token value.
This was also asked in Discourse.
Current behavior:
influx auth create --org example --user grafana --write-user
An auto generated token is created and returned.
Desired behavior:
influx auth create --org example --user grafana --write-user --token-value my-predefined-token
my-predefined-token is set as token and returned.
Alternatives considered:
Use case:
I'm creating a ansible role to allow one to setup and configure InfluxDB 2.X. With the current version 2.0.3, one can't predict token values and have them pre-defined in their favourite Infrastructure As Code utility (Ansible, Terraform, etc...).
For this use case, you can set the operator token when setting up a new instance of influxdb, just not when you manually create an auth. see the helm chart for an example: https://github.com/influxdata/helm-charts/blob/master/charts/influxdb2/templates/job-setup-admin.yaml#L38
+1 for me. I have a similar use case. I'd like to use for some local hobby work the docker versions of InfluxDB2 and Telegraf. Having a token stored in an .env file and used to create a limited scope user AND have it passed in to the telegraf config helps to avoid having to worry about sequencing and restarts. Ansible (or similar) could help there but if I'm needing to do that then it somewhat defeats the point of keeping all in a docker-compose file.
This is also something that would be very useful for my configuration.
This would make host disaster recovery or upgrading from one host to another in the future far easier if both hosts could have the same token for a certain bucket. Without that, anything writing to the new host would either need to switch to the new token quickly or something like a telegraf agent to switch to using the new token.
+1 for me
+1
+1
+1
+1
+1
+1
For our setup, we want to setup all the tokens in an Azure Keyvault (done as part of infrastructure as code pipeline that setups server) and then have the different services have their own token with restricted access. The dynamic method of creating a token using the influx CLI is painful as we then need to extract back to a pipeline variable so it can be pushed to the keyvault and then back to the requisite services
+1
+1
+1
+1
+1
+1