@@ -1060,8 +1060,9 @@ def deploy_metric_filters_and_alarms(region: str, accounts: list, resource_prope
1060
1060
LOGGER .info (f"Filter deploy parameter is 'true'; deploying { filter_name } CloudWatch metric filter..." )
1061
1061
search_log_group , log_group_arn = cloudwatch .find_log_group (filter_params ["log_group_name" ])
1062
1062
if search_log_group is False :
1063
- LOGGER .info (f"Log group { filter_params ['log_group_name' ]} not found! Skipping { filter_name } filter deployment..." )
1064
- LIVE_RUN_DATA [f"{ filter_name } _CloudWatch" ] = f"Log group { filter_params ['log_group_name' ]} not found! Skipped { filter_name } filter deployment."
1063
+ search_message = f"Log group { filter_params ['log_group_name' ]} not found! Skiped { filter_name } filter deployment..."
1064
+ LOGGER .info (search_message )
1065
+ LIVE_RUN_DATA [f"{ filter_name } _CloudWatch" ] = search_message
1065
1066
continue
1066
1067
deploy_metric_filter (
1067
1068
region , acct , filter_params ["log_group_name" ], filter_name , filter_pattern , f"{ filter_name } -metric" , "sra-bedrock" , "1"
@@ -2299,6 +2300,8 @@ def lambda_handler(event: dict, context: Any) -> dict: # noqa: CCR001
2299
2300
global LAMBDA_START
2300
2301
global LAMBDA_FINISH
2301
2302
global LAMBDA_RECORD_ID
2303
+ global DRY_RUN
2304
+
2302
2305
LAMBDA_START = dynamodb .get_date_time ()
2303
2306
LOGGER .info (event )
2304
2307
LOGGER .info ({"boto3 version" : boto3 .__version__ })
@@ -2328,7 +2331,6 @@ def lambda_handler(event: dict, context: Any) -> dict: # noqa: CCR001
2328
2331
LOGGER .info ("DELETE EVENT!!" )
2329
2332
# Set DRY_RUN to False if we are deleting via CloudFormation (should do this with Terraform as well); stack will be gone.
2330
2333
if RESOURCE_TYPE != "Other" :
2331
- global DRY_RUN
2332
2334
DRY_RUN = False
2333
2335
delete_event (event , context )
2334
2336
@@ -2353,20 +2355,20 @@ def lambda_handler(event: dict, context: Any) -> dict: # noqa: CCR001
2353
2355
"end_time" : LAMBDA_FINISH ,
2354
2356
"lambda_result" : "SUCCESS" ,
2355
2357
}
2358
+ if DRY_RUN is False :
2359
+ item_found , find_result = dynamodb .find_item (
2360
+ STATE_TABLE ,
2361
+ SOLUTION_NAME ,
2362
+ {
2363
+ "arn" : context .invoked_function_arn ,
2364
+ },
2365
+ )
2356
2366
2357
- item_found , find_result = dynamodb .find_item (
2358
- STATE_TABLE ,
2359
- SOLUTION_NAME ,
2360
- {
2361
- "arn" : context .invoked_function_arn ,
2362
- },
2363
- )
2364
-
2365
- if item_found is True :
2366
- sra_resource_record_id = find_result ["record_id" ]
2367
- update_state_table_record (sra_resource_record_id , lambda_data )
2368
- else :
2369
- LOGGER .info (f"Lambda record not found in { STATE_TABLE } table so unable to update it." )
2367
+ if item_found is True :
2368
+ sra_resource_record_id = find_result ["record_id" ]
2369
+ update_state_table_record (sra_resource_record_id , lambda_data )
2370
+ else :
2371
+ LOGGER .info (f"Lambda record not found in { STATE_TABLE } table so unable to update it." )
2370
2372
2371
2373
return {
2372
2374
"statusCode" : 200 ,
0 commit comments