Skip to content

coder tokens create lifetime parameter is confusing #14750

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

Open
ammario opened this issue Sep 20, 2024 · 1 comment
Open

coder tokens create lifetime parameter is confusing #14750

ammario opened this issue Sep 20, 2024 · 1 comment
Labels
bug risk Prone to bugs customer-reported Bugs reported by enterprise customers. Only humans may set this.

Comments

@ammario
Copy link
Member

ammario commented Sep 20, 2024

First of all, when creating automation tokens (e.g. for coder/setup-action), you typically want either an unlimited lifetime or a lifetime specified in years/months not hours (which is the largest unit supported by our tokens create command).

This leads to instructions like:

coder token create --lifetime 8760h --name "GitHub Actions"

and mental arithmetic to figure out that token exists for a year.

Secondly, our default lifetime in the CLI appears quite arbitrary at 30 days. A more reasonable default is unlimited, and if the deployment doesn't allow that we can retry the request with whatever the maximum lifetime is.

@coder-labeler coder-labeler bot added docs Area: coder.com/docs feature labels Sep 20, 2024
@ammario ammario added bug risk Prone to bugs and removed docs Area: coder.com/docs labels Sep 20, 2024
@stirby stirby added the customer-reported Bugs reported by enterprise customers. Only humans may set this. label Sep 27, 2024
@matifali matifali removed the feature label Oct 14, 2024
@matifali
Copy link
Member

coder/terraform-provider-coder#117 is related

defelmnq added a commit that referenced this issue Oct 16, 2024
This PR is a proposal to improve the situation described in #14750 

For some precise commands - we would like to be able to use durations
bigger than hours, minutes..

This PR extends the Duration proposed by Go with : 
- `d` - a day or 24hours.
- `y` - a year or 365 days.

I also removed the default value for lifetime and instead fetch the
maxLifetime value from codersdk - so by default if no value set we use
the value defined in the config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug risk Prone to bugs customer-reported Bugs reported by enterprise customers. Only humans may set this.
Projects
None yet
Development

No branches or pull requests

3 participants