From 2f52e70572f69a3cb397ab7a20a6f2c6527081c5 Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Tue, 24 Jun 2025 16:38:28 +0000 Subject: [PATCH] fix hasAITaskResources logic for child modules --- 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 53dcc94831ab0..84174c90b435d 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 } }