Skip to main content

IaC Scanning

IaC scanning analyses Infrastructure-as-Code changes in pull requests and reports the estimated cost impact. It helps your team understand the financial implications of infrastructure changes before they are merged.


How scanning works

  1. A developer opens or updates a pull request that modifies IaC files
  2. frugally.app detects the change and scans the affected files
  3. It compares the proposed infrastructure against current state
  4. A cost-impact analysis is calculated and posted as a PR comment
  5. A GitHub check run reports the scan status (pass/fail)

[SCREENSHOT: github-iac-scan.png -- IaC scan results posted as a PR comment showing cost impact]


Supported frameworks

FrameworkDetected by
Terraform.tf and .tf.json files
CloudFormationTemplates with AWSTemplateFormatVersion
AWS CDKSynthesised templates in cdk.out/
PulumiPulumi.yaml project files
OpenTofu.tf and .tf.json files (same as Terraform)

Scanning is triggered for any PR that modifies files matching these patterns in repositories where the GitHub App has access.


Scan triggers

EventScan triggered?
PR openedYes
PR updated (new commits pushed)Yes
PR reopenedYes
Draft PR openedConfigurable (default: no)
PR to specific branches onlyConfigurable (default: all branches)

Configure triggers at Settings > GitHub > Scan Triggers.


Cost-impact analysis

The scan compares the proposed changes against the current infrastructure and estimates the cost impact:

Change typeExampleImpact
New resourceAdding an EC2 instanceMonthly cost increase
Modified resourceUpgrading instance type from t3.small to t3.largeCost difference (increase or decrease)
Removed resourceDeleting an RDS instanceMonthly cost decrease
No cost impactChanging a tag or description$0 impact

The PR comment shows:

SectionContent
SummaryTotal estimated monthly cost change (e.g. "+$150/month")
BreakdownPer-resource cost changes
Current costWhat the infrastructure costs today
Proposed costWhat it would cost after the change

Configuring scan rules

Navigate to Settings > GitHub > Scan Rules to configure:

Thresholds

SettingDescriptionDefault
Cost increase warningFlag PRs that increase costs above this amount$50/month
Cost increase blockFail the check run for PRs above this amountDisabled
Require approval for high-cost changesLink to Guard approval rulesDisabled

Exclusions

SettingDescription
Excluded pathsFile paths to skip during scanning (e.g. tests/, examples/)
Excluded resourcesResource types to exclude from cost analysis
Excluded branchesBranches where scanning is disabled

Check run status

frugally.app reports scan results as a GitHub check run:

StatusMeaning
PassedCost impact is within configured thresholds
WarningCost impact exceeds the warning threshold
FailedCost impact exceeds the block threshold
SkippedNo IaC changes detected in the PR

You can require the frugally.app check to pass before merging by adding it as a required status check in your branch protection rules.

tip

Start with warning thresholds only. Once your team is comfortable with the scan results, consider adding a block threshold for large cost increases to prevent surprises.


Scan accuracy

Cost estimates are based on AWS on-demand pricing for the region specified in the IaC files. Factors that can affect accuracy:

FactorImpact
Dynamic valuesVariables resolved at apply-time (e.g. instance count from a variable) use default values
ModulesNested modules are resolved and costed individually
Conditional resourcesResources behind count = 0 or for_each with empty sets are excluded
Data transferData transfer costs are not estimated (they depend on runtime usage)
Free tierAWS Free Tier is not factored into estimates