in critter/stack.py [0:0]
def wait_for_config_resources(self):
skip_msg = "Skipping waiting for resources to be recorded by AWS Config"
if self.skip_wait_for_resource_recording:
logger.info(skip_msg)
return
if not self.resource_types:
logger.warning(
f"Warning - {skip_msg}. Config rule '{self.config_rule_name}' scope does not specify "
"applicable resource types."
)
return
logger.info(f"Waiting for {len(self.resources)} resources to be recorded by AWS Config")
logger.info(
f"Searching for resource types {self.resource_types} and resource ids {list(self.resources.keys())}"
)
resource_keys = []
for r_id in self.resources.keys():
for r_type in self.resource_types:
resource_keys.append({"resourceType": r_type, "resourceId": r_id})
found_config_resources = []
loop = 0
while len(found_config_resources) != len(self.resources):
if loop:
time.sleep(self.AWS_CONFIG_API_DELAY_SEC)
found_config_resources = self.config.batch_get_resource_config(resourceKeys=resource_keys)[
"baseConfigurationItems"
]
logger.info(f"Found {len(found_config_resources)} resources recorded by AWS Config")
# TODO: if loop has run for longer than is typically expected, print help message
# if loop * self.AWS_CONFIG_API_DELAY_SEC > 180:
# logger.warning(
# "Warning - Still waiting for resources to be recorded by AWS Config. Ensure "
# f"{self.resource_types} are recorded by AWS Config or consider specifying the critter test stack "
# f"output '{self.OUTPUT_KEYS['SKIP_WAIT_FOR_RESOURCE_RECORDING']}'."
# )
loop += 1