From b6c493d0dc62a029a809005dc044ecc4081bedcd Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Tue, 24 Jun 2025 19:14:44 +0200 Subject: [PATCH] fix: correct hasAITaskResources logic for child modules (#18542) --- provisioner/terraform/resources.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/provisioner/terraform/resources.go b/provisioner/terraform/resources.go index 53dcc94831..84174c90b4 100644 --- a/provisioner/terraform/resources.go +++ b/provisioner/terraform/resources.go @@ -178,7 +178,9 @@ func hasAITaskResources(graph *gographviz.Graph) bool { // Check if this node is a coder_ai_task resource if label, exists := node.Attrs["label"]; exists { labelValue := strings.Trim(label, `"`) - if strings.HasPrefix(labelValue, "coder_ai_task.") { + // The first condition is for the case where the resource is in the root module. + // The second condition is for the case where the resource is in a child module. + if strings.HasPrefix(labelValue, "coder_ai_task.") || strings.Contains(labelValue, ".coder_ai_task.") { return true } }