code: def _lambda_terraform_targets(config, functions, clusters):
      """Return any terraform targets for the function(s) being deployed
  
      NOTE: This is very hacky and should go away. A complete refactor of how we peform
          terraform generation would help with this, but this hack will do for now.
  
      Args:
          config (CLIConfig): The loaded StreamAlert config
          functions (list): Functions to target during deploy
          clusters (list): Clusters to target during deploy
  
      Returns:
          set: Terraform module paths to target during this deployment
      """
  
      target_mapping = {
          "alert": {
              "targets": {
                  "module.alert_processor_iam",
                  "module.alert_processor_lambda",
              },
              "enabled": True,  # required function
          },
          "alert_merger": {
              "targets": {
                  "module.alert_merger_iam",
                  "module.alert_merger_lambda",
              },
              "enabled": True,  # required function
          },
          "athena": {
              "targets": {
                  "module.athena_partitioner_iam",
                  "module.athena_partitioner_lambda",
              },
              "enabled": True,  # required function
          },
          "rule": {
              "targets": {
                  "module.rules_engine_iam",
                  "module.rules_engine_lambda",
              },
              "enabled": True,  # required function
          },
          "classifier": {
              "targets": {
                  "module.classifier_{}_{}".format(cluster, suffix)
                  for suffix in {"lambda", "iam"}
                  for cluster in clusters
              },
              "enabled": bool(
                  clusters
              ),  # one cluster at least is required
          },
          "apps": {
              "targets": {
                  "module.app_{}_{}_{}".format(
                      app_info["app_name"], cluster, suffix
                  )
                  for suffix in {"lambda", "iam"}
                  for cluster in clusters
                  for app_info in config["clusters"][cluster]["modules"]
                  .get("streamalert_apps", {})
                  .values()
                  if "app_name" in app_info
              },
              "enabled": any(
                  info["modules"].get("streamalert_apps")
                  for info in config["clusters"].values()
              ),
          },
          "rule_promo": {
              "targets": {
                  "module.rule_promotion_iam",
                  "module.rule_promotion_lambda",
              },
              "enabled": config["lambda"]
              .get("rule_promotion_config", {})
              .get("enabled", False),
          },
          "scheduled_queries": {
              "targets": {
                  "module.scheduled_queries",
              },
              "enabled": config["scheduled_queries"].get(
                  "enabled", False
              ),
          },
          "threat_intel_downloader": {
              "targets": {
                  "module.threat_intel_downloader",
                  "module.threat_intel_downloader_iam",
              },
              "enabled": config["lambda"].get(
                  "threat_intel_downloader_config", False
              ),
          },
      }
  
      targets = set()
      for function in functions:
          if not target_mapping[function]["enabled"]:
              LOGGER.warning(
                  "Function is not enabled and will be ignored: %s",
                  function,
              )
              continue
  
          targets.update(target_mapping[function]["targets"])
  
      return targets
  
file_path: streamalert/streamalert_cli/manage_lambda/deploy.py
imports: from streamalert.shared import rule_table
  from streamalert.shared.logger import get_logger
  from streamalert_cli.terraform.generate import terraform_generate_handler
  from streamalert_cli.terraform.helpers import terraform_runner
  from streamalert_cli.utils import add_default_lambda_args, CLICommand, MutuallyExclusiveStagingAction, set_parser_epilog
label_desc: Use image node_id 3 for calling a global function with example usage: _lambda_terraform_targets(config, functions, clusters) and returns: targets