| 137 | } |
| 138 | |
| 139 | function isComputeModule(block: HclBlock): boolean { |
| 140 | const source = block.attributes["source"] ?? ""; |
| 141 | // Positive: compute modules |
| 142 | if (source.includes("ecs-service") || source.includes("ecs-worker") || source.includes("lambda")) return true; |
| 143 | // Negative: known non-compute modules |
| 144 | if (source.includes("alarm") || source.includes("logging") || source.includes("s3") || |
| 145 | source.includes("autoscaling") || source.includes("kms") || source.includes("secret") || |
| 146 | source.includes("iam") || source.includes("deploy")) return false; |
| 147 | // Heuristic: modules with image attribute are likely compute |
| 148 | if (block.attributes["image"] || block.attributes["container_image"]) return true; |
| 149 | // Default: include if it has cpu/memory (likely compute) |
| 150 | if (block.attributes["cpu"] || block.attributes["memory"]) return true; |
| 151 | return false; |
| 152 | } |
| 153 | |
| 154 | function inferDeploymentType(moduleSource: string | undefined, resourceType: string): string { |
| 155 | if (moduleSource) { |