Steyn van Wyk
Steyn van Wyk

Reputation: 1

Cloudformation linter regions unsupported

I'm setting up cfn-lint as a pre-commit hook using this guide: https://aws.amazon.com/blogs/mt/git-pre-commit-validation-of-aws-cloudformation-templates-with-cfn-lint/

My .pre-commit-config.yaml:

repos:
-   repo: https://github.com/awslabs/cfn-python-lint
    rev: v1.23.1 # The version of cfn-lint to use
    hooks:
    -   id: cfn-lint
        files: final_stacks/.*\.(json|yml|yaml)$
        args: [--regions, 'eu-west-1']

When I commit a change I get:

(.venv) steyn@Steyns-MacBook-Air aws_ingestion_tools % git commit -m  "Pre-commit test"
AWS CloudFormation Linter................................................Failed
- hook id: cfn-lint
- exit code: 32

2025-01-31 13:31:20,161 - cfnlint.runner - ERROR - Regions ['final_stacks/final_env_client_test_steyn.yml'] are unsupported. Supported regions are ['af-south-1', 'ap-east-1', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-south-1', 'ap-south-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-southeast-3', 'ap-southeast-4', 'ap-southeast-5', 'ap-southeast-7', 'ca-west-1', 'ca-central-1', 'cn-north-1', 'cn-northwest-1', 'eu-central-1', 'eu-central-2', 'eu-north-1', 'eu-south-1', 'eu-south-2', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'il-central-1', 'me-south-1', 'me-central-1', 'sa-east-1', 'us-east-1', 'us-east-2', 'us-gov-east-1', 'us-gov-west-1', 'us-west-1', 'us-west-2']

When I run cfn-lint manually on a template it give no errors:

cfn-lint -t final_stacks/final_env_client_test_steyn.yml --region eu-west-1

Is there a problem with my .pre-commit-config.yaml?

Upvotes: -1

Views: 56

Answers (1)

Steyn van Wyk
Steyn van Wyk

Reputation: 1

Changing the pre commit config to this seemed to do the trick:

# .pre-commit-config.yaml
repos:
-   repo: https://github.com/aws-cloudformation/cfn-lint
    rev: v1.23.1 # The version of cfn-lint to use
    hooks:
    -   id: cfn-lint
        files: final_stacks/.*\.(json|yml|yaml)$

Upvotes: 0

Related Questions