diff --git a/ct_configrecorder_override_consumer.py b/ct_configrecorder_override_consumer.py index 46308e6..cd7a68b 100644 --- a/ct_configrecorder_override_consumer.py +++ b/ct_configrecorder_override_consumer.py @@ -138,8 +138,9 @@ def assume_role(account_id, role='AWSControlTowerExecution'): 'includeGlobalResourceTypes': home_region } }) - logging.info(f'Response for put_configuration_recorder :{response} ') - + logging.warning( + f"Configuration Recorder reset to default. Response: {json.dumps(response, default=str)}" + ) else: if CONFIG_RECORDER_STRATEGY == 'EXCLUSION': # Original exclusion-based code - EXACTLY as in the working version diff --git a/ct_configrecorder_override_producer.py b/ct_configrecorder_override_producer.py index 62afe7c..4867fda 100644 --- a/ct_configrecorder_override_producer.py +++ b/ct_configrecorder_override_producer.py @@ -74,7 +74,7 @@ def lambda_handler(event, context): elif ('LogicalResourceId' in event) and (event['RequestType'] == 'Update'): logging.info('Update Update') logging.info( - 'overriding config recorder for ALL accounts because of first run after function deployment from CloudFormation') + 'overriding config recorder for ALL accounts because of overriding config recorder for ALL accounts because of CloudFormation stack update') override_config_recorder(excluded_accounts, sqs_url, '', 'Update') response = {} update_excluded_accounts(excluded_accounts,sqs_url) @@ -83,8 +83,8 @@ def lambda_handler(event, context): cfnresponse.send(event, context, cfnresponse.SUCCESS, response, "CustomResourcePhysicalID") elif ('LogicalResourceId' in event) and (event['RequestType'] == 'Delete'): logging.info('DELETE DELETE') - logging.info( - 'overriding config recorder for ALL accounts because of first run after function deployment from CloudFormation') + logging.warning( + 'Initiating config recorder cleanup for ALL accounts due to CloudFormation stack deletion') override_config_recorder(excluded_accounts, sqs_url, '', 'Delete') response = {} ## Send signal back to CloudFormation after the final run