feat(cli): add --agents-allowed to template commands (#27517)

Relates to CODAGT-713

Depends on #27515

This adds `--agents-allowed` to `coder templates create` and `coder templates edit`. Template creation defaults the option to true, matching the per-template API and database default, while template editing only changes the value when the flag is explicitly supplied so unrelated edits preserve the existing setting.

The generated CLI help and reference documentation include the new option. #27518 updates the Coder Agents platform controls documentation to describe the completed per-template model.
This commit is contained in:
Ethan
2026-08-06 14:45:38 +10:00
committed by GitHub
parent 6c8a8647f6
commit 78b5a0f5a2
8 changed files with 165 additions and 0 deletions
+8
View File
@@ -21,6 +21,7 @@ func (r *RootCmd) templateCreate() *serpent.Command {
provisionerTags []string
variablesFile string
commandLineVariables []string
agentsAllowed bool
disableEveryone bool
requireActiveVersion bool
@@ -159,6 +160,7 @@ func (r *RootCmd) templateCreate() *serpent.Command {
TimeTilDormantAutoDeleteMillis: ptr.Ref(dormancyAutoDeletion.Milliseconds()),
DisableEveryoneGroupAccess: disableEveryone,
RequireActiveVersion: requireActiveVersion,
AgentsAllowed: &agentsAllowed,
}
template, err := client.CreateTemplate(inv.Context(), organization.ID, createReq)
@@ -179,6 +181,12 @@ func (r *RootCmd) templateCreate() *serpent.Command {
},
}
cmd.Options = serpent.OptionSet{
{
Flag: "agents-allowed",
Description: "Allow Coder Agents to create workspaces using this template.",
Default: "true",
Value: serpent.BoolOf(&agentsAllowed),
},
{
Flag: "private",
Description: "Disable the default behavior of granting template access to the 'everyone' group. " +