Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taskcat failing when Fn::ForEach exist in the template #815

Open
gopinjag opened this issue Nov 16, 2023 · 0 comments
Open

Taskcat failing when Fn::ForEach exist in the template #815

gopinjag opened this issue Nov 16, 2023 · 0 comments

Comments

@gopinjag
Copy link

Describe the bug
Taskcat failing with the error TypeError: list indices must be integers or slices, not str when Fn::ForEach exist in the template.

To Reproduce
Steps to reproduce the behavior:

  1. Are you testing a QuickStart or Custom template? Tested the example AWS template which has Fn::ForEach

  2. Attach or link a copy of the template if possible (remove any sensitive info) - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-foreach-example-resource.html#intrinsic-function-reference-foreach-example-reference-replicated-resource.yaml

  3. Provide the parameters that you passed. (remove any sensitive info) - No parameters but ami id can be replaced with any ami id

  4. How did you install taskcat? (docker or pip3) - pip3

  5. Are you using a profile, an instance role or access keys to run taskcat? - STS credentials from IAM identity center

  6. Is your AWS environment configured via aws configure? yes

Expected behavior
Taskcat should deploy and tear down resources but its failing even before linting with the error ``TypeError: list indices must be integers or slices, not str``` .

I had added -d flag and figured out the below error

File "/opt/homebrew/lib/python3.11/site-packages/taskcat/_cfn/template.py", line 156, in _find_children
    if resource["Type"] == "AWS::CloudFormation::Stack":

Troubleshooting further since the 'Fn::ForEach::Instances': is present in resource block self.template["Resources"].keys() is causing the failure , hence the logic should be updated to handle Fn::ForEach

Screenshots
If applicable, add screenshots to help explain your problem.

**Version (Please make sure you are running the latest version of taskcat)

  • Taskcat Version (ex: [2018.817.210357]) - version 0.9.41
    0.9.41

Note: Python Version (python3 required)

To find versions:
Via taskcat: taskcat -V
Via pip3: pip3 show taskcat

Note: both version should match

To update taskcat run:
for docker : docker pull taskcat/taskcat
for pip3: pip3 install --upgrade taskcat

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant