We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Inline Terraform Skips Broken – v1.0.612
**Describe the bug**
Checkov errors immediately if there are any skips defined in my Terraform resources. Behavior is correct on 1.0.611 but is broken on 1.0.612 and 1.0.613.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a test resource in Terraform
```
resource "aws_s3_bucket" "mybucket" {
  #checkov:skip=CKV_AWS_19:Data in this bucket does not need encryption.
  bucket = "my-bucket"
  acl    = "private"
}
```
2. Run `checkov -d .` on v1.0.612 or v1.0.613.
3. See error

**Expected behavior**
Checkov scans my resources using all checks except CKV_AWS_19.

**Output**
```
checkov -d .
Traceback (most recent call last):
  File "/usr/local/bin/checkov", line 5, in <module>
    run()
  File "/usr/local/lib/python3.9/site-packages/checkov/main.py", line 63, in run
    scan_reports = runner_registry.run(root_folder=root_folder, external_checks_dir=external_checks_dir,
  File "/usr/local/lib/python3.9/site-packages/checkov/common/runners/runner_registry.py", line 30, in run
    scan_report = runner.run(root_folder, external_checks_dir=external_checks_dir, files=files,
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/runner.py", line 55, in run
    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/runner.py", line 89, in check_tf_definition
    definitions_context = parser_registry.enrich_definitions_context(definition, collect_skip_comments)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/context_parsers/registry.py", line 28, in enrich_definitions_context
    self.definitions_context[tf_file][definition_type] = context_parser.run(tf_file, definition_blocks, collect_skip_comments)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/context_parsers/base_parser.py", line 118, in run
    self.context = self._collect_skip_comments(definition_blocks)
  File "/usr/local/lib/python3.9/site-packages/checkov/terraform/context_parsers/base_parser.py", line 87, in _collect_skip_comments
    if skip_check['id'] in bc_id_mapping:
TypeError: argument of type 'NoneType' is not iterable
```

**Desktop (please complete the following information):**
 - Mac 10.15.7
 - 1.0.612, 1.0.613

**Additional context**
I imagine this may have to do with the change at https://github.com/bridgecrewio/checkov/commit/751b0aace12dfd0f0f24cd042a659f9eab3bf24d#diff-79435bbd626a6a0ce4070183c5f5070eb31621991464e9948ec5de7d021ad15aR65


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `checkov/terraform/context_parsers/base_parser.py`
Content:
```
1 import logging
2 import re
3 from abc import ABC, abstractmethod
4 from itertools import islice
5 
6 import dpath.util
7 
8 from checkov.common.comment.enum import COMMENT_REGEX
9 from checkov.common.models.enums import ContextCategories
10 from checkov.terraform.context_parsers.registry import parser_registry
11 from checkov.common.bridgecrew.platform_integration import bc_integration
12 
13 OPEN_CURLY = '{'
14 CLOSE_CURLY = '}'
15 
16 
17 class BaseContextParser(ABC):
18     definition_type = ""
19     tf_file = ""
20     file_lines = []
21     context = {}
22 
23     def __init__(self, definition_type):
24         self.logger = logging.getLogger("{}".format(self.__module__))
25         if definition_type.upper() not in ContextCategories.__members__:
26             self.logger.error("Terraform context parser type not supported yet")
27             raise Exception()
28         self.definition_type = definition_type
29         parser_registry.register(self)
30 
31     @abstractmethod
32     def get_entity_context_path(self, entity_block):
33         """
34         returns the entity's path in the context parser
35         :param entity_block: entity definition block
36         :return: list of nested entity's keys in the context parser
37         """
38         raise NotImplementedError
39 
40     def _is_block_signature(self, line_num, line_tokens, entity_context_path):
41         """
42         Determine if the given tokenized line token is the entity signature line
43         :param line_num: The line number in the file
44         :param line_tokens: list of line tokens
45         :param entity_context_path: the entity's path in the context parser
46         :return: True/False
47         """
48         block_type = self.get_block_type()
49         return all(x in line_tokens for x in [block_type] + entity_context_path)
50 
51     @staticmethod
52     def _trim_whitespaces_linebreaks(text):
53         return text.strip()
54 
55     def _filter_file_lines(self):
56         parsed_file_lines = [(ind, self._trim_whitespaces_linebreaks(line)) for (ind, line) in self.file_lines]
57         self.filtered_lines = [(ind, line) for (ind, line) in parsed_file_lines if line]
58         return self.filtered_lines
59 
60     def _read_file_lines(self):
61         with(open(self.tf_file, 'r')) as file:
62             file.seek(0)
63             file_lines = [(ind + 1, line) for (ind, line) in
64                           list(enumerate(file.readlines()))]
65             return file_lines
66 
67     def _collect_skip_comments(self, definition_blocks):
68         """
69         Collects checkov skip comments to all definition blocks
70         :param definition_blocks: parsed definition blocks
71         :return: context enriched with with skipped checks per skipped entity
72         """
73         bc_id_mapping = bc_integration.get_id_mapping()
74         parsed_file_lines = self.filtered_lines
75         comments = [(line_num, {"id": re.search(COMMENT_REGEX, x).group(2),
76                                 "suppress_comment": re.search(COMMENT_REGEX, x).group(3)[1:] if re.search(COMMENT_REGEX,
77                                                                                                           x).group(3)
78                                 else "No comment provided"}) for (line_num, x) in
79                     parsed_file_lines if re.search(COMMENT_REGEX, x)]
80         for entity_block in definition_blocks:
81             skipped_checks = []
82             entity_context_path = self.get_entity_context_path(entity_block)
83             context_search = dpath.search(self.context, entity_context_path, yielded=True)
84             for _, entity_context in context_search:
85                 for (skip_check_line_num, skip_check) in comments:
86                     if entity_context['start_line'] < skip_check_line_num < entity_context['end_line']:
87                         if skip_check['id'] in bc_id_mapping:
88                             skip_check['id'] = bc_id_mapping[skip_check['id']]
89                         skipped_checks.append(skip_check)
90             dpath.new(self.context, entity_context_path + ['skipped_checks'], skipped_checks)
91         return self.context
92 
93     def _compute_definition_end_line(self, start_line_num):
94         """ Given the code block's start line, compute the block's end line
95         :param start_line_num: code block's first line number (the signature line)
96         :return: the code block's last line number
97         """
98         parsed_file_lines = self.filtered_lines
99         start_line_idx = [line_num for (line_num, _) in parsed_file_lines].index(start_line_num)
100         i = 1
101         end_line_num = 0
102         for (line_num, line) in islice(parsed_file_lines, start_line_idx + 1, None):
103             if OPEN_CURLY in line:
104                 i = i + 1
105             if CLOSE_CURLY in line:
106                 i = i - 1
107                 if i == 0:
108                     end_line_num = line_num
109                     break
110         return end_line_num
111 
112     def run(self, tf_file, definition_blocks, collect_skip_comments=True):
113         self.tf_file = tf_file
114         self.context = {}
115         self.file_lines = self._read_file_lines()
116         self.context = self.enrich_definition_block(definition_blocks)
117         if collect_skip_comments:
118             self.context = self._collect_skip_comments(definition_blocks)
119         return self.context
120 
121     def get_block_type(self):
122         return self.definition_type
123 
124     def enrich_definition_block(self, definition_blocks):
125         """
126         Enrich the context of a Terraform block
127         :param definition_blocks: Terraform block, key-value dictionary
128         :return: Enriched block context
129         """
130         parsed_file_lines = self._filter_file_lines()
131         potential_block_start_lines = [(ind, line) for (ind, line) in parsed_file_lines if line.startswith(self.get_block_type())]
132         for i, entity_block in enumerate(definition_blocks):
133             entity_context_path = self.get_entity_context_path(entity_block)
134             for line_num, line in potential_block_start_lines:
135                 line_tokens = [x.replace('"', "") for x in line.split()]
136                 if self._is_block_signature(line_num, line_tokens, entity_context_path):
137                     logging.debug(f'created context for {" ".join(entity_context_path)}')
138                     start_line = line_num
139                     end_line = self._compute_definition_end_line(line_num)
140                     dpath.new(self.context, entity_context_path + ["start_line"], start_line)
141                     dpath.new(self.context, entity_context_path + ["end_line"], end_line)
142                     dpath.new(self.context, entity_context_path + ["code_lines"],
143                               self.file_lines[start_line - 1: end_line])
144                     potential_block_start_lines.remove((line_num, line))
145                     break
146         return self.context
147
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/checkov/terraform/context_parsers/base_parser.py b/checkov/terraform/context_parsers/base_parser.py
--- a/checkov/terraform/context_parsers/base_parser.py
+++ b/checkov/terraform/context_parsers/base_parser.py
@@ -84,7 +84,7 @@
             for _, entity_context in context_search:
                 for (skip_check_line_num, skip_check) in comments:
                     if entity_context['start_line'] < skip_check_line_num < entity_context['end_line']:
-                        if skip_check['id'] in bc_id_mapping:
+                        if bc_id_mapping and skip_check['id'] in bc_id_mapping:
                             skip_check['id'] = bc_id_mapping[skip_check['id']]
                         skipped_checks.append(skip_check)
             dpath.new(self.context, entity_context_path + ['skipped_checks'], skipped_checks)

{"golden_diff": "diff --git a/checkov/terraform/context_parsers/base_parser.py b/checkov/terraform/context_parsers/base_parser.py\n--- a/checkov/terraform/context_parsers/base_parser.py\n+++ b/checkov/terraform/context_parsers/base_parser.py\n@@ -84,7 +84,7 @@\n             for _, entity_context in context_search:\n                 for (skip_check_line_num, skip_check) in comments:\n                     if entity_context['start_line'] < skip_check_line_num < entity_context['end_line']:\n-                        if skip_check['id'] in bc_id_mapping:\n+                        if bc_id_mapping and skip_check['id'] in bc_id_mapping:\n                             skip_check['id'] = bc_id_mapping[skip_check['id']]\n                         skipped_checks.append(skip_check)\n             dpath.new(self.context, entity_context_path + ['skipped_checks'], skipped_checks)\n", "issue": "Inline Terraform Skips Broken \u2013 v1.0.612\n**Describe the bug**\r\nCheckov errors immediately if there are any skips defined in my Terraform resources. Behavior is correct on 1.0.611 but is broken on 1.0.612 and 1.0.613.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Create a test resource in Terraform\r\n```\r\nresource \"aws_s3_bucket\" \"mybucket\" {\r\n  #checkov:skip=CKV_AWS_19:Data in this bucket does not need encryption.\r\n  bucket = \"my-bucket\"\r\n  acl    = \"private\"\r\n}\r\n```\r\n2. Run `checkov -d .` on v1.0.612 or v1.0.613.\r\n3. See error\r\n\r\n**Expected behavior**\r\nCheckov scans my resources using all checks except CKV_AWS_19.\r\n\r\n**Output**\r\n```\r\ncheckov -d .\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/checkov\", line 5, in <module>\r\n    run()\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/main.py\", line 63, in run\r\n    scan_reports = runner_registry.run(root_folder=root_folder, external_checks_dir=external_checks_dir,\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/common/runners/runner_registry.py\", line 30, in run\r\n    scan_report = runner.run(root_folder, external_checks_dir=external_checks_dir, files=files,\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/runner.py\", line 55, in run\r\n    self.check_tf_definition(report, root_folder, runner_filter, collect_skip_comments)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/runner.py\", line 89, in check_tf_definition\r\n    definitions_context = parser_registry.enrich_definitions_context(definition, collect_skip_comments)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/context_parsers/registry.py\", line 28, in enrich_definitions_context\r\n    self.definitions_context[tf_file][definition_type] = context_parser.run(tf_file, definition_blocks, collect_skip_comments)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/context_parsers/base_parser.py\", line 118, in run\r\n    self.context = self._collect_skip_comments(definition_blocks)\r\n  File \"/usr/local/lib/python3.9/site-packages/checkov/terraform/context_parsers/base_parser.py\", line 87, in _collect_skip_comments\r\n    if skip_check['id'] in bc_id_mapping:\r\nTypeError: argument of type 'NoneType' is not iterable\r\n```\r\n\r\n**Desktop (please complete the following information):**\r\n - Mac 10.15.7\r\n - 1.0.612, 1.0.613\r\n\r\n**Additional context**\r\nI imagine this may have to do with the change at https://github.com/bridgecrewio/checkov/commit/751b0aace12dfd0f0f24cd042a659f9eab3bf24d#diff-79435bbd626a6a0ce4070183c5f5070eb31621991464e9948ec5de7d021ad15aR65\r\n\n", "before_files": [{"content": "import logging\nimport re\nfrom abc import ABC, abstractmethod\nfrom itertools import islice\n\nimport dpath.util\n\nfrom checkov.common.comment.enum import COMMENT_REGEX\nfrom checkov.common.models.enums import ContextCategories\nfrom checkov.terraform.context_parsers.registry import parser_registry\nfrom checkov.common.bridgecrew.platform_integration import bc_integration\n\nOPEN_CURLY = '{'\nCLOSE_CURLY = '}'\n\n\nclass BaseContextParser(ABC):\n    definition_type = \"\"\n    tf_file = \"\"\n    file_lines = []\n    context = {}\n\n    def __init__(self, definition_type):\n        self.logger = logging.getLogger(\"{}\".format(self.__module__))\n        if definition_type.upper() not in ContextCategories.__members__:\n            self.logger.error(\"Terraform context parser type not supported yet\")\n            raise Exception()\n        self.definition_type = definition_type\n        parser_registry.register(self)\n\n    @abstractmethod\n    def get_entity_context_path(self, entity_block):\n        \"\"\"\n        returns the entity's path in the context parser\n        :param entity_block: entity definition block\n        :return: list of nested entity's keys in the context parser\n        \"\"\"\n        raise NotImplementedError\n\n    def _is_block_signature(self, line_num, line_tokens, entity_context_path):\n        \"\"\"\n        Determine if the given tokenized line token is the entity signature line\n        :param line_num: The line number in the file\n        :param line_tokens: list of line tokens\n        :param entity_context_path: the entity's path in the context parser\n        :return: True/False\n        \"\"\"\n        block_type = self.get_block_type()\n        return all(x in line_tokens for x in [block_type] + entity_context_path)\n\n    @staticmethod\n    def _trim_whitespaces_linebreaks(text):\n        return text.strip()\n\n    def _filter_file_lines(self):\n        parsed_file_lines = [(ind, self._trim_whitespaces_linebreaks(line)) for (ind, line) in self.file_lines]\n        self.filtered_lines = [(ind, line) for (ind, line) in parsed_file_lines if line]\n        return self.filtered_lines\n\n    def _read_file_lines(self):\n        with(open(self.tf_file, 'r')) as file:\n            file.seek(0)\n            file_lines = [(ind + 1, line) for (ind, line) in\n                          list(enumerate(file.readlines()))]\n            return file_lines\n\n    def _collect_skip_comments(self, definition_blocks):\n        \"\"\"\n        Collects checkov skip comments to all definition blocks\n        :param definition_blocks: parsed definition blocks\n        :return: context enriched with with skipped checks per skipped entity\n        \"\"\"\n        bc_id_mapping = bc_integration.get_id_mapping()\n        parsed_file_lines = self.filtered_lines\n        comments = [(line_num, {\"id\": re.search(COMMENT_REGEX, x).group(2),\n                                \"suppress_comment\": re.search(COMMENT_REGEX, x).group(3)[1:] if re.search(COMMENT_REGEX,\n                                                                                                          x).group(3)\n                                else \"No comment provided\"}) for (line_num, x) in\n                    parsed_file_lines if re.search(COMMENT_REGEX, x)]\n        for entity_block in definition_blocks:\n            skipped_checks = []\n            entity_context_path = self.get_entity_context_path(entity_block)\n            context_search = dpath.search(self.context, entity_context_path, yielded=True)\n            for _, entity_context in context_search:\n                for (skip_check_line_num, skip_check) in comments:\n                    if entity_context['start_line'] < skip_check_line_num < entity_context['end_line']:\n                        if skip_check['id'] in bc_id_mapping:\n                            skip_check['id'] = bc_id_mapping[skip_check['id']]\n                        skipped_checks.append(skip_check)\n            dpath.new(self.context, entity_context_path + ['skipped_checks'], skipped_checks)\n        return self.context\n\n    def _compute_definition_end_line(self, start_line_num):\n        \"\"\" Given the code block's start line, compute the block's end line\n        :param start_line_num: code block's first line number (the signature line)\n        :return: the code block's last line number\n        \"\"\"\n        parsed_file_lines = self.filtered_lines\n        start_line_idx = [line_num for (line_num, _) in parsed_file_lines].index(start_line_num)\n        i = 1\n        end_line_num = 0\n        for (line_num, line) in islice(parsed_file_lines, start_line_idx + 1, None):\n            if OPEN_CURLY in line:\n                i = i + 1\n            if CLOSE_CURLY in line:\n                i = i - 1\n                if i == 0:\n                    end_line_num = line_num\n                    break\n        return end_line_num\n\n    def run(self, tf_file, definition_blocks, collect_skip_comments=True):\n        self.tf_file = tf_file\n        self.context = {}\n        self.file_lines = self._read_file_lines()\n        self.context = self.enrich_definition_block(definition_blocks)\n        if collect_skip_comments:\n            self.context = self._collect_skip_comments(definition_blocks)\n        return self.context\n\n    def get_block_type(self):\n        return self.definition_type\n\n    def enrich_definition_block(self, definition_blocks):\n        \"\"\"\n        Enrich the context of a Terraform block\n        :param definition_blocks: Terraform block, key-value dictionary\n        :return: Enriched block context\n        \"\"\"\n        parsed_file_lines = self._filter_file_lines()\n        potential_block_start_lines = [(ind, line) for (ind, line) in parsed_file_lines if line.startswith(self.get_block_type())]\n        for i, entity_block in enumerate(definition_blocks):\n            entity_context_path = self.get_entity_context_path(entity_block)\n            for line_num, line in potential_block_start_lines:\n                line_tokens = [x.replace('\"', \"\") for x in line.split()]\n                if self._is_block_signature(line_num, line_tokens, entity_context_path):\n                    logging.debug(f'created context for {\" \".join(entity_context_path)}')\n                    start_line = line_num\n                    end_line = self._compute_definition_end_line(line_num)\n                    dpath.new(self.context, entity_context_path + [\"start_line\"], start_line)\n                    dpath.new(self.context, entity_context_path + [\"end_line\"], end_line)\n                    dpath.new(self.context, entity_context_path + [\"code_lines\"],\n                              self.file_lines[start_line - 1: end_line])\n                    potential_block_start_lines.remove((line_num, line))\n                    break\n        return self.context\n", "path": "checkov/terraform/context_parsers/base_parser.py"}], "after_files": [{"content": "import logging\nimport re\nfrom abc import ABC, abstractmethod\nfrom itertools import islice\n\nimport dpath.util\n\nfrom checkov.common.comment.enum import COMMENT_REGEX\nfrom checkov.common.models.enums import ContextCategories\nfrom checkov.terraform.context_parsers.registry import parser_registry\nfrom checkov.common.bridgecrew.platform_integration import bc_integration\n\nOPEN_CURLY = '{'\nCLOSE_CURLY = '}'\n\n\nclass BaseContextParser(ABC):\n    definition_type = \"\"\n    tf_file = \"\"\n    file_lines = []\n    context = {}\n\n    def __init__(self, definition_type):\n        self.logger = logging.getLogger(\"{}\".format(self.__module__))\n        if definition_type.upper() not in ContextCategories.__members__:\n            self.logger.error(\"Terraform context parser type not supported yet\")\n            raise Exception()\n        self.definition_type = definition_type\n        parser_registry.register(self)\n\n    @abstractmethod\n    def get_entity_context_path(self, entity_block):\n        \"\"\"\n        returns the entity's path in the context parser\n        :param entity_block: entity definition block\n        :return: list of nested entity's keys in the context parser\n        \"\"\"\n        raise NotImplementedError\n\n    def _is_block_signature(self, line_num, line_tokens, entity_context_path):\n        \"\"\"\n        Determine if the given tokenized line token is the entity signature line\n        :param line_num: The line number in the file\n        :param line_tokens: list of line tokens\n        :param entity_context_path: the entity's path in the context parser\n        :return: True/False\n        \"\"\"\n        block_type = self.get_block_type()\n        return all(x in line_tokens for x in [block_type] + entity_context_path)\n\n    @staticmethod\n    def _trim_whitespaces_linebreaks(text):\n        return text.strip()\n\n    def _filter_file_lines(self):\n        parsed_file_lines = [(ind, self._trim_whitespaces_linebreaks(line)) for (ind, line) in self.file_lines]\n        self.filtered_lines = [(ind, line) for (ind, line) in parsed_file_lines if line]\n        return self.filtered_lines\n\n    def _read_file_lines(self):\n        with(open(self.tf_file, 'r')) as file:\n            file.seek(0)\n            file_lines = [(ind + 1, line) for (ind, line) in\n                          list(enumerate(file.readlines()))]\n            return file_lines\n\n    def _collect_skip_comments(self, definition_blocks):\n        \"\"\"\n        Collects checkov skip comments to all definition blocks\n        :param definition_blocks: parsed definition blocks\n        :return: context enriched with with skipped checks per skipped entity\n        \"\"\"\n        bc_id_mapping = bc_integration.get_id_mapping()\n        parsed_file_lines = self.filtered_lines\n        comments = [(line_num, {\"id\": re.search(COMMENT_REGEX, x).group(2),\n                                \"suppress_comment\": re.search(COMMENT_REGEX, x).group(3)[1:] if re.search(COMMENT_REGEX,\n                                                                                                          x).group(3)\n                                else \"No comment provided\"}) for (line_num, x) in\n                    parsed_file_lines if re.search(COMMENT_REGEX, x)]\n        for entity_block in definition_blocks:\n            skipped_checks = []\n            entity_context_path = self.get_entity_context_path(entity_block)\n            context_search = dpath.search(self.context, entity_context_path, yielded=True)\n            for _, entity_context in context_search:\n                for (skip_check_line_num, skip_check) in comments:\n                    if entity_context['start_line'] < skip_check_line_num < entity_context['end_line']:\n                        if bc_id_mapping and skip_check['id'] in bc_id_mapping:\n                            skip_check['id'] = bc_id_mapping[skip_check['id']]\n                        skipped_checks.append(skip_check)\n            dpath.new(self.context, entity_context_path + ['skipped_checks'], skipped_checks)\n        return self.context\n\n    def _compute_definition_end_line(self, start_line_num):\n        \"\"\" Given the code block's start line, compute the block's end line\n        :param start_line_num: code block's first line number (the signature line)\n        :return: the code block's last line number\n        \"\"\"\n        parsed_file_lines = self.filtered_lines\n        start_line_idx = [line_num for (line_num, _) in parsed_file_lines].index(start_line_num)\n        i = 1\n        end_line_num = 0\n        for (line_num, line) in islice(parsed_file_lines, start_line_idx + 1, None):\n            if OPEN_CURLY in line:\n                i = i + 1\n            if CLOSE_CURLY in line:\n                i = i - 1\n                if i == 0:\n                    end_line_num = line_num\n                    break\n        return end_line_num\n\n    def run(self, tf_file, definition_blocks, collect_skip_comments=True):\n        self.tf_file = tf_file\n        self.context = {}\n        self.file_lines = self._read_file_lines()\n        self.context = self.enrich_definition_block(definition_blocks)\n        if collect_skip_comments:\n            self.context = self._collect_skip_comments(definition_blocks)\n        return self.context\n\n    def get_block_type(self):\n        return self.definition_type\n\n    def enrich_definition_block(self, definition_blocks):\n        \"\"\"\n        Enrich the context of a Terraform block\n        :param definition_blocks: Terraform block, key-value dictionary\n        :return: Enriched block context\n        \"\"\"\n        parsed_file_lines = self._filter_file_lines()\n        potential_block_start_lines = [(ind, line) for (ind, line) in parsed_file_lines if line.startswith(self.get_block_type())]\n        for i, entity_block in enumerate(definition_blocks):\n            entity_context_path = self.get_entity_context_path(entity_block)\n            for line_num, line in potential_block_start_lines:\n                line_tokens = [x.replace('\"', \"\") for x in line.split()]\n                if self._is_block_signature(line_num, line_tokens, entity_context_path):\n                    logging.debug(f'created context for {\" \".join(entity_context_path)}')\n                    start_line = line_num\n                    end_line = self._compute_definition_end_line(line_num)\n                    dpath.new(self.context, entity_context_path + [\"start_line\"], start_line)\n                    dpath.new(self.context, entity_context_path + [\"end_line\"], end_line)\n                    dpath.new(self.context, entity_context_path + [\"code_lines\"],\n                              self.file_lines[start_line - 1: end_line])\n                    potential_block_start_lines.remove((line_num, line))\n                    break\n        return self.context\n", "path": "checkov/terraform/context_parsers/base_parser.py"}]}