Skip to content

Commit 23d0c85

Browse files
github-actions[bot]jmeza-xyzbigkevmcdmatttrach
authored
fix: update default token TTL to match Rancher (#2220)
Signed-off-by: Meza <meza-xyz@proton.me> Co-authored-by: Meza <meza-xyz@proton.me> Co-authored-by: Kevin McDermott <bigkevmcd@gmail.com> Co-authored-by: Matt Trachier <matt.trachier@suse.com>
1 parent 84dc033 commit 23d0c85

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

aspell_custom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ oidc
4141
eslint
4242
destructuring
4343
yaml
44+
ttl
4445
pkce

docs/resources/custom_user_token.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The following arguments are supported:
5252
* `cluster_id` - (Optional/ForceNew) Cluster ID for scoped token (string)
5353
* `description` - (Optional/ForceNew) Token description (string)
5454
* `renew` - (Optional/ForceNew) Renew token if expired or disabled. If `true`, a terraform diff would be generated to renew the token if it's disabled or expired. If `false`, the token will not be renewed. Default `true` (bool)
55-
* `ttl` - (Optional/ForceNew) Token time to live in seconds. Default `0` (int)
55+
* `ttl` - (Optional/ForceNew) Token time to live in seconds. Default `0` (int)
5656

5757
From Rancher v2.4.6 `ttl` is read in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.
5858

docs/resources/token.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ The following arguments are supported:
3535
* `cluster_id` - (Optional/ForceNew) Cluster ID for scoped token (string)
3636
* `description` - (Optional/ForceNew) Token description (string)
3737
* `renew` - (Optional/ForceNew) Renew token if expired or disabled. If `true`, a terraform diff would be generated to renew the token if it's disabled or expired. If `false`, the token will not be renewed. Default `true` (bool)
38-
* `ttl` - (Optional/ForceNew) Token time to live in seconds. Default `0` (int)
38+
* `ttl` - (Optional/ForceNew) Defaults to the `auth-token-max-ttl-minutes` Rancher setting.
3939

40-
From Rancher v2.4.6 `ttl` is readed in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.
40+
From Rancher v2.4.6 `ttl` is read in minutes at Rancher API. To avoid breaking change on the provider, we still read in seconds but rounding up division if required.
41+
42+
From Rancher v2.8.0 the Rancher API and kubeconfig tokens `ttl` is managed by Rancher setting `auth-token-max-ttl-minutes`. Tokens created before v2.8.0 are not affected.
4143

4244
## Attributes Reference
4345

rancher2/schema_token.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
const (
88
tokenDefaultSessionDesc = "Terraform token temp token"
9-
tokenDefaultTTL = "60000"
109
)
1110

1211
//Schemas
@@ -66,10 +65,10 @@ func tokenFields() map[string]*schema.Schema {
6665
},
6766
"ttl": {
6867
Type: schema.TypeInt,
68+
Computed: true,
6969
Optional: true,
7070
ForceNew: true,
71-
Default: 0,
72-
Description: "Token time to live in seconds",
71+
Description: "Defaults to auth-token-max-ttl-minutes Rancher setting",
7372
},
7473
"user_id": {
7574
Type: schema.TypeString,

0 commit comments

Comments
 (0)