IF Commons GitHub

logical/detect

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-estate-iac-importers FR-007

Which importer reads a file: by what is in it, since a name says little (plan.json, stack.json, main.yaml). A JSON with values or planned_values is OpenTofu or Terraform (show -json does not say which wrote it, so the caller says, and Terraform is assumed), one with Resources is CloudFormation, one with deployment.resources is Pulumi; a YAML with services is Compose, one with Resources or AWSTemplateFormatVersion is CloudFormation, one with apiVersion and kind is Kubernetes.

import { detectTool } from "./detect.ts";
detectTool("a.yaml", "services:\n  web:\n    image: x\n"); // "compose"

Source: commons/estate-iac/src/logical/detect.ts

2 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.detectToolfunctionno test imports it
function detectTool(_source: string, text: string, prefer?: "opentofu" | "terraform"): "cloudformation" | "compose" | "kubernetes" | "opentofu" | "pulumi" | "terraform" | undefined

The tool a file is of, or nothing where it is none the importers read.

logical.importTextfunctionno test imports it
function importText(source: string, text: string, prefer?: "opentofu" | "terraform"): Imports

The assets and links of a file, by the importer its content says, or a problem where no importer reads it.

detectToolfunction
function detectTool(_source: string, text: string, prefer?: "opentofu" | "terraform"): "cloudformation" | "compose" | "kubernetes" | "opentofu" | "pulumi" | "terraform" | undefined

The tool a file is of, or nothing where it is none the importers read.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

importTextfunction
function importText(source: string, text: string, prefer?: "opentofu" | "terraform"): Imports

The assets and links of a file, by the importer its content says, or a problem where no importer reads it.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.