You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Encountered "IndexError: list index out of range" when accounts are provisioned to a previously empty OU and there are stack_set resources defined in the manifest.yaml targetted to the OU.
To Reproduce
Set up Control Tower
Create a new OU (for example "TEST")
Deploy CfCT
Update manifest to deploy a valid stack set to the "TEST" OU and upload the manifest file to s3 bucket (the CfCT pipeline and Step Functions are working fine when the OU is still empty)
Provision a new account to "TEST" OU, Step Functions execution for the stackset instance is executed but failed at "CustomControlTowerStateMachineLambda"
Input StackInstanceAccountList is an empty list. However, the code checks only if the StackInstanceAccountList is not None, and tries to access the first account ID in the empty list which cause an error.
I manually added a stack instance (via console) to one of the target accounts, then trigger the pipeline again, the Step Functions execution is working fine.
The text was updated successfully, but these errors were encountered:
We hit the same bug. As no contributions are accepted, if anyone is reading this, we fixed it by changing the following code:
diff --git a/source/src/cfct/state_machine_handler.py b/source/src/cfct/state_machine_handler.py
index 961a747..30e65c2 100644
--- a/source/src/cfct/state_machine_handler.py
+++ b/source/src/cfct/state_machine_handler.py
@@ -223,7 +223,7 @@ class CloudFormation(object):
# to trigger create operation accordingly.
if (
not response.get("Summaries")
- and self.event.get("StackInstanceAccountList") is None
+ and (self.event.get("StackInstanceAccountList") is None or not self.event.get("StackInstanceAccountList"))
):
self._set_only_create_stack_instance_operation()
return self.event
Describe the bug
Encountered "IndexError: list index out of range" when accounts are provisioned to a previously empty OU and there are stack_set resources defined in the manifest.yaml targetted to the OU.
To Reproduce
Expected behavior
CfCT creates stackset instances successfully
Please complete the following information about the solution:
Screenshots
If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information).
Additional context
Log messages from CloudWatch Logs of the Lambda function
Input StackInstanceAccountList is an empty list. However, the code checks only if the StackInstanceAccountList is not None, and tries to access the first account ID in the empty list which cause an error.
I manually added a stack instance (via console) to one of the target accounts, then trigger the pipeline again, the Step Functions execution is working fine.
The text was updated successfully, but these errors were encountered: