From b7f5770109cc5d8b7ddaafe500ccd00554d76d05 Mon Sep 17 00:00:00 2001 From: Pat Heard Date: Tue, 12 Nov 2024 09:46:10 -0500 Subject: [PATCH] fix: format the billing tag extract JSON (#320) Update the Lamda function so that the output JSON is formatted. This is needed to allow the Glue Crawler to properly detected the object fields. --- .../cost_usage_report/lambdas/billing_extract_tags/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/terragrunt/org_account/cost_usage_report/lambdas/billing_extract_tags/main.py b/terragrunt/org_account/cost_usage_report/lambdas/billing_extract_tags/main.py index c6c9aabe..eb746d4c 100644 --- a/terragrunt/org_account/cost_usage_report/lambdas/billing_extract_tags/main.py +++ b/terragrunt/org_account/cost_usage_report/lambdas/billing_extract_tags/main.py @@ -61,9 +61,7 @@ def handler(event, context): # .write json to string and add a newline between each record logging.info("Writing account tags to json") - accounts = json.dumps(accounts, default=str) - accounts = accounts.replace("}, ", "},\n") - accounts = accounts.replace("[{", "[\n{") + accounts = json.dumps(accounts, default=str, indent=2) logging.info(f"Accounts: {accounts}") # save accounts to an s3 bucket