Overview

Quickstart: Static IaC Scan

Run your first static IaC scan with the CloudBurn SDK using scanStatic().


scanStatic() analyzes your infrastructure-as-code files locally — no AWS credentials required. It parses Terraform, CloudFormation, and CDK files and applies CloudBurn's cost optimization rules.

Full example

import { CloudBurnClient } from '@cloudburn/sdk';

const client = new CloudBurnClient();
const result = await client.scanStatic('./infrastructure');

for (const provider of result.providers) {
  for (const finding of provider.rules) {
    console.log(`[${finding.ruleId}] ${finding.message}`);
    for (const match of finding.findings) {
      console.log(`  ${match.resourceId} at ${match.location?.path}:${match.location?.line}`);
    }
  }
}

ScanResult shape

scanStatic() returns a Promise<ScanResult>:

type ScanResult = {
  diagnostics?: ScanDiagnostic[];
  providers: ProviderFindingGroup[];
};

type ProviderFindingGroup = {
  provider: CloudProvider;   // 'aws' | 'azure' | 'gcp'
  rules: Finding[];
};

type Finding = {
  ruleId: string;
  service: string;
  source: Source;            // 'iac' for static scans
  message: string;
  findings: FindingMatch[];
};

type FindingMatch = {
  resourceId: string;
  accountId?: string;
  region?: string;
  location?: SourceLocation; // file path + line/column
};

result.providers is an array grouped by cloud provider. Each Finding represents one rule that matched, and findings lists every individual resource that triggered it.

Filtering with config

Pass an inline config to scope the scan to specific services or rules:

const result = await client.scanStatic('./iac', {
  iac: {
    services: ['ec2', 'ebs'],
  },
});

Enable or disable specific rules:

const result = await client.scanStatic('./iac', {
  iac: {
    enabledRules: ['CLDBRN-AWS-EBS-1', 'CLDBRN-AWS-EC2-1'],
  },
});

You can also load config from a file and merge overrides:

const config = await client.loadConfig();
const result = await client.scanStatic('./iac', {
  ...config,
  iac: { ...config.iac, services: ['ec2'] },
});

What's next

Quickstart: Discovery ScanScan live AWS resources
Custom ConfigurationLoad and override config programmatically
RulesBrowse available rules and rule IDs