Analyzer Setup
FinFocus integrates with Pulumi’s analyzer framework as a Policy Pack. This allows you to see real-time cost
estimates directly within your pulumi preview and pulumi up workflow.
Prerequisites
Section titled “Prerequisites”- Pulumi CLI installed
finfocusbinary built (runmake build)
Setup Instructions
Section titled “Setup Instructions”finfocus analyzer install creates the policy pack at ~/.finfocus/analyzer.
The directory holds:
PulumiPolicy.yamlpulumi-analyzer-policy-finfocus, which Pulumi before 3.270.0 startspulumi-language-finfocus, which Pulumi 3.270.0 and later starts
On Windows both entries end in .exe.
finfocus analyzer installAn existing pack that has only pulumi-analyzer-policy-finfocus is updated by
running finfocus analyzer install again.
Enable the Analyzer
Section titled “Enable the Analyzer”The pack directory must be on your PATH, and the preview must point at that
directory. Pulumi 3.270.0 and later starts pulumi-language-finfocus from
PATH. Older releases start pulumi-analyzer-policy-finfocus the same way.
Option A: CLI Flag (Recommended for testing)
Section titled “Option A: CLI Flag (Recommended for testing)”export PATH="${HOME}/.finfocus/analyzer:${PATH}"pulumi preview --policy-pack ~/.finfocus/analyzerOption B: Environment Variable (Recommended for CI/CD)
Section titled “Option B: Environment Variable (Recommended for CI/CD)”export PATH="${HOME}/.finfocus/analyzer:${PATH}"export PULUMI_POLICY_PACK_PATH="$HOME/.finfocus/analyzer"pulumi previewOnce configured, cost estimates will appear as advisory diagnostics in your Pulumi output:
Policies: finfocus@v0.3.0 (local: ~/.finfocus/analyzer) - [advisory] [severity: low] cost-estimate (aws:ec2/instance:Instance: my-instance) Estimated Monthly Cost: $7.50 USD (source: finfocus-plugin-aws) - [advisory] [severity: low] stack-cost-summary (pulumi:pulumi:Stack: my-stack) Total Estimated Monthly Cost: $7.50 USD (1 resources analyzed)A resource the plugin prices as spot adds its spot label after the cost line,
for example Estimated Monthly Cost: $21.90 USD (source: finfocus-plugin-aws) | SPOT · risk 0.12 · -62% vs on-demand.
Troubleshooting
Section titled “Troubleshooting”no language plugin ‘pulumi-language-finfocus’
Section titled “no language plugin ‘pulumi-language-finfocus’”Pulumi 3.270.0 and later fails the preview when the language plugin entry is missing:
no language plugin 'pulumi-language-finfocus' found in the workspace or on your $PATHPulumi may also print a 404 while looking up a download named pulumi-finfocus
(could not find latest version). Re-run finfocus analyzer install and keep
~/.finfocus/analyzer on PATH.
“could not start policy pack”
Section titled ““could not start policy pack””Ensure:
~/.finfocus/analyzer/containsPulumiPolicy.yaml,pulumi-analyzer-policy-finfocus, andpulumi-language-finfocus(both binaries end in.exeon Windows).- The directory is on your PATH:
export PATH="${HOME}/.finfocus/analyzer:${PATH}". Pulumi searches PATH for the entry it starts. Placing the files only in the policy pack directory is not sufficient.
No cost diagnostics appear
Section titled “No cost diagnostics appear”-
Verify that
PulumiPolicy.yamlexists in the same directory as the binary. -
Ensure you are passing the correct path to
--policy-pack. -
Check logs by enabling debug mode:
Terminal window FINFOCUS_LOG_LEVEL=debug pulumi preview --policy-pack ~/.finfocus/analyzer
Technical Details
Section titled “Technical Details”For a deep dive into how the analyzer works, see the Analyzer Integration Guide.