cfn-lint - Man Page

cfn-lint – CloudFormation Linter

Synopsis

cfn-lint [OPTION...] [TEMPLATE]

Options

-h,  --help

Show a help message and exit

Standard

TEMPLATE

The CloudFormation template to be linted

-t TEMPLATE [TEMPLATE ...], --template TEMPLATE [TEMPLATE ...]

The CloudFormation template to be linted

-b, --ignore-bad-template

Ignore failures with Bad template

--ignore-templates IGNORE_TEMPLATES [IGNORE_TEMPLATES ...]

Ignore templates

-f {quiet,parseable,json,junit,pretty,sarif}, --format {quiet,parseable,json,junit,pretty,sarif}

Output Format

-l, --list-rules

list all the rules

-r REGIONS [REGIONS ...], --regions REGIONS [REGIONS ...]

list the regions to validate against

-i IGNORE_CHECKS [IGNORE_CHECKS ...], --ignore-checks IGNORE_CHECKS [IGNORE_CHECKS ...]

only check rules whose id do not match these values

-c INCLUDE_CHECKS [INCLUDE_CHECKS ...], --include-checks INCLUDE_CHECKS [INCLUDE_CHECKS ...]

include rules whose id match these values

-m MANDATORY_CHECKS [MANDATORY_CHECKS ...], --mandatory-checks MANDATORY_CHECKS [MANDATORY_CHECKS ...]

always check rules whose id match these values, regardless of template exclusions

-e, --include-experimental

Include experimental rules

-x CONFIGURE_RULES [CONFIGURE_RULES ...], --configure-rule CONFIGURE_RULES [CONFIGURE_RULES ...]

Provide configuration for a rule. Format RuleId:key=value.

Example:

E3012:strict=true
--config-file CONFIG_FILE

Specify the cfnlintrc file to use

-z CUSTOM_RULES, --custom-rules CUSTOM_RULES

Allows specification of a custom rule file.

-v, --version

Version of cfn-lint(1)

--output-file OUTPUT_FILE

Writes the output to the specified file, ideal for producing reports

--merge-configs

Merges lists between configuration layers

--non-zero-exit-code {informational,warning,error,none}

Exit code will be non zero from the specified rule class and higher

Advanced / Debugging

-D,  --debug

Enable debug logging

-I,  --info

Enable information logging

-a APPEND_RULES [APPEND_RULES ...], --append-rules APPEND_RULES [APPEND_RULES ...]

specify one or more rules directories using one or more --append-rules arguments.

-o OVERRIDE_SPEC, --override-spec OVERRIDE_SPEC

A CloudFormation Spec override file that allows customization

-g,  --build-graph

Creates a file in the same directory as the template that models the template’s resources in dot(1) format

-s REGISTRY_SCHEMAS [REGISTRY_SCHEMAS ...], --registry-schemas REGISTRY_SCHEMAS [REGISTRY_SCHEMAS ...]

one or more directories of CloudFormation Registry Schemas

-u,  --update-specs

Update the CloudFormation Specs

Examples

Basic:
cfn-lint test.yaml
Ignore a rule:
cfn-lint -i E3012 -- test.yaml
Configure a rule:
cfn-lint -x E3012:strict=true -t test.yaml
Lint all yaml files in a folder:
cfn-lint dir/**/*.yaml

See Also

dot(1)

Info

June 2024