Repository: bridgecrewio/checkov

Issue:
crash introduce by https://github.com/bridgecrewio/checkov/pull/2356
**Describe the issue**

```
checkov -d test1/
```

**Examples**
test1/job.tf
```hcl
resource "aws_batch_job_definition" "foobar" {
  name                 = "foobar"
  type                 = "container"
  container_properties = file("${path.module}/job_definition.json")
}
```

**Exception Trace**
Please share the trace for the exception and all relevant output by checkov.
To maximize the understanding, please run checkov with LOG_LEVEL set to debug
as follows:
```sh
2022-02-08 16:55:00,816 [MainThread  ] [DEBUG]  Checkov version: 2.0.809
2022-02-08 16:55:00,816 [MainThread  ] [DEBUG]  Python executable: /usr/bin/python3
2022-02-08 16:55:00,816 [MainThread  ] [DEBUG]  Python version: 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)]
2022-02-08 16:55:00,816 [MainThread  ] [DEBUG]  Checkov executable (argv[0]): /home/foobar/.local/bin/checkov
2022-02-08 16:55:00,816 [MainThread  ] [DEBUG]  Command Line Args:   -d test1/
Config File (/home/foobar/git/production/.checkov.yaml):
  framework:         terraform
  baseline:          .checkov.baseline
  evaluate-variables:True
  compact:           True
  quiet:             True
Defaults:
  --branch:          master
  --download-external-modules:False
  --external-modules-download-path:.external_modules
  --min-cve-severity:none

2022-02-08 16:55:00,817 [MainThread  ] [INFO ]  Resultant set of frameworks (removing skipped frameworks): terraform
2022-02-08 16:55:00,817 [MainThread  ] [DEBUG]  terraform_runner declares no system dependency checks required.
2022-02-08 16:55:00,817 [MainThread  ] [DEBUG]  No API key found. Scanning locally only.
2022-02-08 16:55:01,377 [MainThread  ] [DEBUG]  Got checkov mappings from Bridgecrew BE
2022-02-08 16:55:01,378 [MainThread  ] [INFO ]  Scanning root folder and producing fresh tf_definitions and context
2022-02-08 16:55:01,378 [MainThread  ] [INFO ]  Parsing HCL files in source dir
2022-02-08 16:55:01,379 [MainThread  ] [DEBUG]  Parsing /home/foobar/git/production/test1/job.tf
2022-02-08 16:55:01,383 [MainThread  ] [DEBUG]  Module load loop 0
2022-02-08 16:55:01,384 [MainThread  ] [INFO ]  Building graph from parsed module
2022-02-08 16:55:01,384 [MainThread  ] [INFO ]  Creating vertices
2022-02-08 16:55:01,384 [MainThread  ] [INFO ]  Creating edges
2022-02-08 16:55:01,385 [MainThread  ] [INFO ]  Rendering variables, graph has 1 vertices and 0 edges
2022-02-08 16:55:01,385 [MainThread  ] [INFO ]  done evaluating edges
2022-02-08 16:55:01,385 [MainThread  ] [INFO ]  done evaluate_non_rendered_values
2022-02-08 16:55:01,386 [MainThread  ] [DEBUG]  created context for aws_batch_job_definition foobar
2022-02-08 16:55:01,386 [MainThread  ] [DEBUG]  Created definitions context
2022-02-08 16:55:01,386 [MainThread  ] [DEBUG]  Scanning file: /job.tf
2022-02-08 16:55:01,386 [MainThread  ] [DEBUG]  Running check: Batch job does not define a privileged container on file /job.tf
2022-02-08 16:55:01,386 [MainThread  ] [ERROR]  Failed to run check: Batch job does not define a privileged container for configuration: {'container_properties': ['file("path.module/job_definition.json")'], 'name': ['foobar'], 'type': ['container']} at file: /job.tf
Traceback (most recent call last):
  File "/home/foobar/.local/bin/checkov", line 9, in <module>
    sys.exit(run())
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/main.py", line 223, in run
    scan_reports = runner_registry.run(root_folder=root_folder, external_checks_dir=external_checks_dir,
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/common/runners/runner_registry.py", line 59, in run
    reports = [self.runners[0].run(root_folder, external_checks_dir=external_checks_dir, files=files,
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/terraform/runner.py", line 119, in run
    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/terraform/runner.py", line 212, in check_tf_definition
    self.run_all_blocks(definition, self.context, full_file_path, root_folder, report,
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/terraform/runner.py", line 222, in run_all_blocks
    self.run_block(definition[block_type], definitions_context,
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/terraform/runner.py", line 294, in run_block
    results = registry.scan(scanned_file, entity, skipped_checks, runner_filter)
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/common/checks/base_check_registry.py", line 121, in scan
    result = self.run_check(check, entity_configuration, entity_name, entity_type, scanned_file, skip_info)
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/common/checks/base_check_registry.py", line 135, in run_check
    result = check.run(
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/common/checks/base_check.py", line 81, in run
    raise e
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/common/checks/base_check.py", line 68, in run
    check_result["result"] = self.scan_entity_conf(entity_configuration, entity_type)
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/terraform/checks/resource/base_resource_check.py", line 54, in scan_entity_conf
    return self.scan_resource_conf(conf)
  File "/home/foobar/.local/lib/python3.10/site-packages/checkov/terraform/checks/resource/aws/BatchJobIsNotPrivileged.py", line 17, in scan_resource_conf
    container = json.loads(conf.get("container_properties")[0])
  File "/usr/lib64/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```

**Desktop (please complete the following information):**
 - OS: Fedora 35
 - Checkov Version: 2.0.809

**Additional context**
This issue appears from https://github.com/bridgecrewio/checkov/pull/2356


Discussion:

Resolving patch:
diff --git a/checkov/terraform/checks/resource/aws/BatchJobIsNotPrivileged.py b/checkov/terraform/checks/resource/aws/BatchJobIsNotPrivileged.py
--- a/checkov/terraform/checks/resource/aws/BatchJobIsNotPrivileged.py
+++ b/checkov/terraform/checks/resource/aws/BatchJobIsNotPrivileged.py
@@ -14,7 +14,10 @@ def __init__(self):
     def scan_resource_conf(self, conf):
         if conf.get("container_properties"):
             if type(conf.get("container_properties")[0]) is str:
-                container = json.loads(conf.get("container_properties")[0])
+                try:
+                    container = json.loads(conf.get("container_properties")[0])
+                except json.JSONDecodeError as e:
+                    return CheckResult.UNKNOWN
             else:
                 container = conf.get("container_properties")[0]
             if container.get("privileged"):


Test patch:
diff --git a/tests/terraform/checks/resource/aws/example_BatchJobIsNotPrivileged/main.tf b/tests/terraform/checks/resource/aws/example_BatchJobIsNotPrivileged/main.tf
--- a/tests/terraform/checks/resource/aws/example_BatchJobIsNotPrivileged/main.tf
+++ b/tests/terraform/checks/resource/aws/example_BatchJobIsNotPrivileged/main.tf
@@ -1,3 +1,9 @@
+resource "aws_batch_job_definition" "unknown2" {
+  name                 = "foobar"
+  type                 = "container"
+  container_properties = file("${path.module}/job_definition.json")
+}
+
 
 resource "aws_batch_job_definition" "fail" {
   name = "tf_test_batch_job_definition"
@@ -164,3 +170,5 @@ resource "aws_batch_job_definition" "pass3" {
     ]
   })
 }
+
+