code: def get_tf_modules(config, generate=False):
      if generate:
          if not terraform_generate_handler(
              config=config, check_tf=False, check_creds=False
          ):
              return False
  
      modules = set()
      resources = set()
      for root, _, files in os.walk(config.build_directory):
          for file_name in files:
              path = os.path.join(root, file_name)
              if path.endswith(".tf.json"):
                  with open(path, "r") as tf_file:
                      tf_data = json.load(tf_file)
                      modules.update(set((tf_data["module"])))
                      resources.update(
                          "{}.{}".format(resource, value)
                          for resource, values in tf_data.get(
                              "resource", {}
                          ).items()
                          for value in values
                      )
  
      return {"module": modules, "resource": resources}
  
imports: from fnmatch import fnmatch
  import json
  import os
  from streamalert.shared.config import firehose_alerts_bucket
  from streamalert.shared.logger import get_logger
  from streamalert.shared.utils import get_data_file_format
  from streamalert_cli.athena.handler import create_table, create_log_tables
  from streamalert_cli.helpers import check_credentials, continue_prompt, run_command
  from streamalert_cli.manage_lambda.deploy import deploy
  from streamalert_cli.terraform.generate import terraform_generate_handler
  from streamalert_cli.terraform.helpers import terraform_check, terraform_runner
  from streamalert_cli.utils import add_clusters_arg, CLICommand, set_parser_epilog, UniqueSortedListAction
label_desc: Use image node_id 3 for calling a global function with example usage: get_tf_modules(config, generate) and returns: dict, False