Skip to content

StackSetNotFoundException in Producer Lambda due to hardcoded StackSet name #37

@k-okuya

Description

@k-okuya

Description

I encountered a runtime error in the Producer Lambda function (ct_configrecorder_override_producer.py) after deploying the solution.
The Lambda function failed to find the StackSet because it seems to be looking for an exact string match for AWSControlTowerBP-BASELINE-CONFIG.

In my environment (Control Tower 3.3), the actual StackSet name was created with a prefix and suffix, rather than the exact fixed name.

  • Expected (Hardcoded): AWSControlTowerBP-BASELINE-CONFIG
  • Actual (My Environment): StackSet-AWSControlTowerBP-BASELINE-CONFIG-f1219aba-9ea0-457c-bf9a-3a8ca78f79d5

Error Log

StackSetNotFoundException: An error occurred (StackSetNotFoundException) when calling the ListStackInstances operation: StackSet AWSControlTowerBP-BASELINE-CONFIG not found

Root Cause

The StackSet name appears to be hardcoded in ct_configrecorder_override_producer.py:

# ct_configrecorder_override_producer.py

def override_config_recorder(...):
    # ...
    if account == '':
        page_iterator = paginator.paginate(StackSetName='AWSControlTowerBP-BASELINE-CONFIG')
    else:
        page_iterator = paginator.paginate(StackSetName='AWSControlTowerBP-BASELINE-CONFIG', StackInstanceAccount=account)

Suggested Fix

It would be great if the code could handle dynamic StackSet names (e.g., by searching for a StackSet that contains AWSControlTowerBP-BASELINE-CONFIG instead of an exact match), as the name may vary depending on the deployment environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions