From 73996b1c26963d00a73db2b6dbe08915799eef88 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 05:39:13 +0000 Subject: [PATCH 1/3] feat(agentapi): add enable_tasks variable to conditionally create coder_ai_task resource This allows users to disable AI task creation when using the agentapi module with count = 0, avoiding the validation requirement for 'AI Prompt' parameter. When enable_tasks = false, the coder_ai_task resource will not be created, allowing the module to be used without defining the required AI Prompt parameter. --- registry/coder/modules/agentapi/README.md | 1 + registry/coder/modules/agentapi/main.tf | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/registry/coder/modules/agentapi/README.md b/registry/coder/modules/agentapi/README.md index 0b5ed0ba4..653401124 100644 --- a/registry/coder/modules/agentapi/README.md +++ b/registry/coder/modules/agentapi/README.md @@ -28,6 +28,7 @@ module "agentapi" { cli_app_display_name = "Goose CLI" module_dir_name = local.module_dir_name install_agentapi = var.install_agentapi + enable_tasks = var.enable_tasks # Set to false to disable AI tasks pre_install_script = var.pre_install_script post_install_script = var.post_install_script start_script = local.start_script diff --git a/registry/coder/modules/agentapi/main.tf b/registry/coder/modules/agentapi/main.tf index 225a992d3..455d47393 100644 --- a/registry/coder/modules/agentapi/main.tf +++ b/registry/coder/modules/agentapi/main.tf @@ -156,6 +156,11 @@ variable "module_dir_name" { description = "Name of the subdirectory in the home directory for module files." } +variable "enable_tasks" { + type = bool + description = "Whether to enable AI tasks. When false, the coder_ai_task resource will not be created, avoiding the requirement for an 'AI Prompt' parameter." + default = true +} locals { # we always trim the slash for consistency @@ -240,7 +245,9 @@ resource "coder_app" "agentapi_cli" { } resource "coder_ai_task" "agentapi" { + count = var.enable_tasks ? 1 : 0 + sidebar_app { id = coder_app.agentapi_web.id } -} +} \ No newline at end of file From 41cf2c6fabab4e9dcb07e33232002199968f086d Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 05:42:44 +0000 Subject: [PATCH 2/3] fix: format README.md to pass CI checks Remove extra space before comment to match prettier formatting rules. --- registry/coder/modules/agentapi/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/agentapi/README.md b/registry/coder/modules/agentapi/README.md index 653401124..a84ad6a58 100644 --- a/registry/coder/modules/agentapi/README.md +++ b/registry/coder/modules/agentapi/README.md @@ -28,7 +28,7 @@ module "agentapi" { cli_app_display_name = "Goose CLI" module_dir_name = local.module_dir_name install_agentapi = var.install_agentapi - enable_tasks = var.enable_tasks # Set to false to disable AI tasks + enable_tasks = var.enable_tasks # Set to false to disable AI tasks pre_install_script = var.pre_install_script post_install_script = var.post_install_script start_script = local.start_script From 4ce3cd189a59a740c2150fc92b4ada3f58685591 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 05:44:46 +0000 Subject: [PATCH 3/3] fix: remove extra blank line to pass terraform fmt check Terraform fmt requires consistent spacing in resource blocks. --- registry/coder/modules/agentapi/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/agentapi/main.tf b/registry/coder/modules/agentapi/main.tf index 455d47393..d81ddea2a 100644 --- a/registry/coder/modules/agentapi/main.tf +++ b/registry/coder/modules/agentapi/main.tf @@ -246,7 +246,7 @@ resource "coder_app" "agentapi_cli" { resource "coder_ai_task" "agentapi" { count = var.enable_tasks ? 1 : 0 - + sidebar_app { id = coder_app.agentapi_web.id }