aws-ia / taskcat

Test all the CloudFormation things! (with TaskCat)
https://aws-ia.github.io/taskcat/
Apache License 2.0
1.16k stars 213 forks source link

ValueError cannot find suitable AWS partition #787

Closed xfudox closed 1 year ago

xfudox commented 1 year ago

Describe the bug Running taskcat in a gitlab pipeline on a merge request.

Expected behavior taskcat running correctly without error

Version

Gitlab pipeline job

testing:
  image: public.ecr.aws/sam/build-python3.7
  stage: testing
  before_script:
    - aws configure set aws_access_key_id $AWS_REGION
    - aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
    - aws configure set default.region $AWS_REGION

    - python --version
    - curl -O https://bootstrap.pypa.io/get-pip.py
    - python3 get-pip.py --user
    - pip install --upgrade pip
    - pip3 install taskcat --user
    - export PATH=$PATH:~/.local/bin
  script:
    - taskcat test run

taskcat config file

general:
  auth:
    default: default
project:
  name: my-project
  regions:
    - eu-central-1
  parameters:
    StageName: testing
    ApplicationArtifactsBucketName: testing-bucket-name
    StripeSecretKey: (redacted)
  package_lambda: false
  shorten_stack_name: true
tests:
  stack-test:
    template: ./template.yaml

Pipeline command output

$ taskcat test run
 _            _             _   
| |_ __ _ ___| | _____ __ _| |_ 
| __/ _` / __| |/ / __/ _` | __|
| || (_| \__ \   < (_| (_| | |_ 
 \__\__,_|___/_|\_\___\__,_|\__|

version 0.9.36
Not in terminal, reprint now using normal build-in print function.
[WARN   ] : No stacks were created... skipping cleanup.
[ERROR  ] : ValueError cannot find suitable AWS partition
Cleaning up project directory and file based variables
andrew-glenn commented 1 year ago

@xfudox please rotate the API Key you provided in your taskcat config.

This usually happens when you provide credentials for one partition (govcloud etc) and try to launch in another

xfudox commented 1 year ago

Ok got it.

Read online that this error can occur when credentials are invalid or wrongly formatted, and than noticed that i mistakenly copy-pasted $AWS_REGION as input for aws configure set aws_access_key_id command.

Fixed it, not it works perfectly.