Format all source files in the resolved module under $Path.
Routes to the engine matching the module's ecosystem:
- bicep -> Format-AvmBicepModule (bicep format)
- terraform -> Format-AvmTerraformModule (terraform fmt -recursive)
The ecosystem is determined by Get-AvmModuleContext, which honours the .avm/context.psd1 override file and the -Ecosystem filter.
The required tool binary (bicep or terraform) is resolved against the bundled avm.pins; install missing tools beforehand with 'avm tool install bicep' / 'avm tool install terraform'.
Routed by the dispatcher: 'avm format'.
avm format
Invoke-AvmFormat [[-Path] <string>] [-Ecosystem <string>] [-AllowPathFallback] [-CheckDrift] [-SkipModuleVersionCheck] [-WhatIf] [-Confirm] [<CommonParameters>]When set, accept a PATH-resolved tool binary that self-reports the lock-pinned version. Off by default; production callers usually want only the managed cache.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Report-only mode used by pr-check. Any file that is not already formatted makes the result Status 'fail' and is emitted as an Issue, instead of being silently rewritten. Without it a CI run fixes formatting in the throwaway working copy and reports a pass, so badly formatted sources merge unnoticed.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Force the ecosystem selector to 'bicep' or 'terraform' regardless of heuristics. Defaults to 'auto'.
| Property | Value |
|---|---|
| Type | String |
| Required | false |
| Position | named |
| Default value | auto |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Working directory whose enclosing module to format. Defaults to the current location.
| Property | Value |
|---|---|
| Type | String |
| Required | false |
| Position | 1 |
| Default value | $PWD.Path |
| Accept pipeline input | false |
| Accept wildcard characters | false |
Skip the PowerShell Gallery check that otherwise stops the command when a newer Avm.Authoring version is available. Writes a warning once.
| Property | Value |
|---|---|
| Type | Switch |
| Required | false |
| Position | named |
| Default value | False |
| Accept pipeline input | false |
| Accept wildcard characters | false |
avm format
# Detect ecosystem from the current directory and format every
# source file under the module root.avm format --check-drift
# Fail instead of rewriting: what pr-check runs.Invoke-AvmFormat -Path C:\repos\my-module -Ecosystem bicepavm format --allow-path-fallback
# Use bicep / terraform from the host PATH when the managed cache
# is empty (useful in tightly-controlled CI images).pscustomobject from the engine: Status, Engine, Tool, ToolPath, ToolSource, FilesProcessed, Changed, Issues.