fix(cli): add --max-ttl to template create (#9319)

It was just in template edit by mistake.
This commit is contained in:
Ammar Bandukwala
2023-08-25 11:00:38 -05:00
committed by GitHub
parent 3b1ecd3c2f
commit f149db6ca6
3 changed files with 25 additions and 4 deletions
+12 -4
View File
@@ -29,9 +29,11 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
variablesFile string
variables []string
disableEveryone bool
defaultTTL time.Duration
failureTTL time.Duration
inactivityTTL time.Duration
defaultTTL time.Duration
failureTTL time.Duration
inactivityTTL time.Duration
maxTTL time.Duration
uploadFlags templateUploadFlags
)
@@ -44,7 +46,7 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
r.InitClient(client),
),
Handler: func(inv *clibase.Invocation) error {
if failureTTL != 0 || inactivityTTL != 0 {
if failureTTL != 0 || inactivityTTL != 0 || maxTTL != 0 {
// This call can be removed when workspace_actions is no longer experimental
experiments, exErr := client.Experiments(inv.Context())
if exErr != nil {
@@ -134,6 +136,7 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
VersionID: job.ID,
DefaultTTLMillis: ptr.Ref(defaultTTL.Milliseconds()),
FailureTTLMillis: ptr.Ref(failureTTL.Milliseconds()),
MaxTTLMillis: ptr.Ref(maxTTL.Milliseconds()),
TimeTilDormantMillis: ptr.Ref(inactivityTTL.Milliseconds()),
DisableEveryoneGroupAccess: disableEveryone,
}
@@ -198,6 +201,11 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
Default: "0h",
Value: clibase.DurationOf(&inactivityTTL),
},
{
Flag: "max-ttl",
Description: "Edit the template maximum time before shutdown - workspaces created from this template must shutdown within the given duration after starting. This is an enterprise-only feature.",
Value: clibase.DurationOf(&maxTTL),
},
{
Flag: "test.provisioner",
Description: "Customize the provisioner backend.",
+5
View File
@@ -21,6 +21,11 @@ Create a template from the current directory or as specified by flag
Specify an inactivity TTL for workspaces created from this template.
This licensed feature's default is 0h (off).
--max-ttl duration
Edit the template maximum time before shutdown - workspaces created
from this template must shutdown within the given duration after
starting. This is an enterprise-only feature.
-m, --message string
Specify a message describing the changes in this version of the
template. Messages longer than 72 characters will be displayed as