prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  False positive for CKV_AZURE_43: check storage account name
  I'm building my Storage Account names like this
  ```
  name                = "${local.saname_prefix}diagnostics${module.tf-var-project.random_id}
  ```
  
  With https://github.com/bridgecrewio/checkov/pull/429 merged I now get a Check failure on the SA name:
  
  ```
  Check: CKV_AZURE_43: "Ensure the Storage Account naming rules"
  	FAILED for resource: azurerm_storage_account.diagnostics
  	File: /az_diag_sa.tf:8-22
  
  		8  | resource "azurerm_storage_account" "diagnostics" {
  		9  |   #checkov:skip=CKV_AZURE_35:Public access is allowed
  		10 |   name                = "${local.saname_prefix}diagnostics${module.tf-var-project.random_id}"
  
  ````
  
  --- 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/checks/resource/azure/StorageAccountName.py`
  Content:
  ```
  1 from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
  2 from checkov.common.models.enums import CheckResult, CheckCategories
  3 import re
  4 from typing import List
  5 
  6 STO_NAME_REGEX = re.compile('^[a-z0-9]{3,24}$')
  7 
  8 
  9 class StorageAccountName(BaseResourceCheck):
  10     def __init__(self):
  11         name = "Ensure Storage Accounts adhere to the naming rules"
  12         id = "CKV_AZURE_43"
  13         supported_resources = ['azurerm_storage_account']
  14         categories = [CheckCategories.CONVENTION]
  15         super().__init__(name=name, id=id, categories=categories,
  16                          supported_resources=supported_resources)
  17 
  18     def scan_resource_conf(self, conf):
  19         """
  20             The Storage Account naming reference:
  21             https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#naming-storage-accounts
  22         :param conf: azurerm_storage_account configuration
  23         :return: <CheckResult>
  24         """
  25         return CheckResult.PASSED if conf.get('name') and re.findall(STO_NAME_REGEX, str(conf['name'][0])) else CheckResult.FAILED
  26 
  27     def get_evaluated_keys(self) -> List[str]:
  28         return ['name']
  29 
  30 
  31 check = StorageAccountName()
  32
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/checkov/terraform/checks/resource/azure/StorageAccountName.py b/checkov/terraform/checks/resource/azure/StorageAccountName.py
  --- a/checkov/terraform/checks/resource/azure/StorageAccountName.py
  +++ b/checkov/terraform/checks/resource/azure/StorageAccountName.py
  @@ -1,31 +1,41 @@
  +import re
  +from typing import List, Dict, Any
  +
   from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
   from checkov.common.models.enums import CheckResult, CheckCategories
  -import re
  -from typing import List
   
  -STO_NAME_REGEX = re.compile('^[a-z0-9]{3,24}$')
  +STO_NAME_REGEX = re.compile(r"^[a-z0-9]{3,24}$")
  +VARIABLE_REFS = ("local.", "module.", "var.")
   
   
   class StorageAccountName(BaseResourceCheck):
  -    def __init__(self):
  +    def __init__(self) -> None:
           name = "Ensure Storage Accounts adhere to the naming rules"
           id = "CKV_AZURE_43"
  -        supported_resources = ['azurerm_storage_account']
  +        supported_resources = ["azurerm_storage_account"]
           categories = [CheckCategories.CONVENTION]
  -        super().__init__(name=name, id=id, categories=categories,
  -                         supported_resources=supported_resources)
  +        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)
   
  -    def scan_resource_conf(self, conf):
  +    def scan_resource_conf(self, conf: Dict[str, Any]) -> CheckResult:
           """
               The Storage Account naming reference:
               https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#naming-storage-accounts
           :param conf: azurerm_storage_account configuration
           :return: <CheckResult>
           """
  -        return CheckResult.PASSED if conf.get('name') and re.findall(STO_NAME_REGEX, str(conf['name'][0])) else CheckResult.FAILED
  +        name = conf.get("name")
  +        if name:
  +            name = name[0]
  +            if any(x in name for x in VARIABLE_REFS):
  +                # in the case we couldn't evaluate the name, just ignore
  +                return CheckResult.UNKNOWN
  +            if re.findall(STO_NAME_REGEX, str(conf["name"][0])):
  +                return CheckResult.PASSED
  +
  +        return CheckResult.FAILED
   
       def get_evaluated_keys(self) -> List[str]:
  -        return ['name']
  +        return ["name"]
   
   
   check = StorageAccountName()
  
verification_info: {"golden_diff": "diff --git a/checkov/terraform/checks/resource/azure/StorageAccountName.py b/checkov/terraform/checks/resource/azure/StorageAccountName.py\n--- a/checkov/terraform/checks/resource/azure/StorageAccountName.py\n+++ b/checkov/terraform/checks/resource/azure/StorageAccountName.py\n@@ -1,31 +1,41 @@\n+import re\n+from typing import List, Dict, Any\n+\n from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\n from checkov.common.models.enums import CheckResult, CheckCategories\n-import re\n-from typing import List\n \n-STO_NAME_REGEX = re.compile('^[a-z0-9]{3,24}$')\n+STO_NAME_REGEX = re.compile(r\"^[a-z0-9]{3,24}$\")\n+VARIABLE_REFS = (\"local.\", \"module.\", \"var.\")\n \n \n class StorageAccountName(BaseResourceCheck):\n-    def __init__(self):\n+    def __init__(self) -> None:\n         name = \"Ensure Storage Accounts adhere to the naming rules\"\n         id = \"CKV_AZURE_43\"\n-        supported_resources = ['azurerm_storage_account']\n+        supported_resources = [\"azurerm_storage_account\"]\n         categories = [CheckCategories.CONVENTION]\n-        super().__init__(name=name, id=id, categories=categories,\n-                         supported_resources=supported_resources)\n+        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n \n-    def scan_resource_conf(self, conf):\n+    def scan_resource_conf(self, conf: Dict[str, Any]) -> CheckResult:\n         \"\"\"\n             The Storage Account naming reference:\n             https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#naming-storage-accounts\n         :param conf: azurerm_storage_account configuration\n         :return: <CheckResult>\n         \"\"\"\n-        return CheckResult.PASSED if conf.get('name') and re.findall(STO_NAME_REGEX, str(conf['name'][0])) else CheckResult.FAILED\n+        name = conf.get(\"name\")\n+        if name:\n+            name = name[0]\n+            if any(x in name for x in VARIABLE_REFS):\n+                # in the case we couldn't evaluate the name, just ignore\n+                return CheckResult.UNKNOWN\n+            if re.findall(STO_NAME_REGEX, str(conf[\"name\"][0])):\n+                return CheckResult.PASSED\n+\n+        return CheckResult.FAILED\n \n     def get_evaluated_keys(self) -> List[str]:\n-        return ['name']\n+        return [\"name\"]\n \n \n check = StorageAccountName()\n", "issue": "False positive for CKV_AZURE_43: check storage account name\nI'm building my Storage Account names like this\r\n```\r\nname                = \"${local.saname_prefix}diagnostics${module.tf-var-project.random_id}\r\n```\r\n\r\nWith https://github.com/bridgecrewio/checkov/pull/429 merged I now get a Check failure on the SA name:\r\n\r\n```\r\nCheck: CKV_AZURE_43: \"Ensure the Storage Account naming rules\"\r\n\tFAILED for resource: azurerm_storage_account.diagnostics\r\n\tFile: /az_diag_sa.tf:8-22\r\n\r\n\t\t8  | resource \"azurerm_storage_account\" \"diagnostics\" {\r\n\t\t9  |   #checkov:skip=CKV_AZURE_35:Public access is allowed\r\n\t\t10 |   name                = \"${local.saname_prefix}diagnostics${module.tf-var-project.random_id}\"\r\n\r\n````\n", "before_files": [{"content": "from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\nfrom checkov.common.models.enums import CheckResult, CheckCategories\nimport re\nfrom typing import List\n\nSTO_NAME_REGEX = re.compile('^[a-z0-9]{3,24}$')\n\n\nclass StorageAccountName(BaseResourceCheck):\n    def __init__(self):\n        name = \"Ensure Storage Accounts adhere to the naming rules\"\n        id = \"CKV_AZURE_43\"\n        supported_resources = ['azurerm_storage_account']\n        categories = [CheckCategories.CONVENTION]\n        super().__init__(name=name, id=id, categories=categories,\n                         supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf):\n        \"\"\"\n            The Storage Account naming reference:\n            https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#naming-storage-accounts\n        :param conf: azurerm_storage_account configuration\n        :return: <CheckResult>\n        \"\"\"\n        return CheckResult.PASSED if conf.get('name') and re.findall(STO_NAME_REGEX, str(conf['name'][0])) else CheckResult.FAILED\n\n    def get_evaluated_keys(self) -> List[str]:\n        return ['name']\n\n\ncheck = StorageAccountName()\n", "path": "checkov/terraform/checks/resource/azure/StorageAccountName.py"}], "after_files": [{"content": "import re\nfrom typing import List, Dict, Any\n\nfrom checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck\nfrom checkov.common.models.enums import CheckResult, CheckCategories\n\nSTO_NAME_REGEX = re.compile(r\"^[a-z0-9]{3,24}$\")\nVARIABLE_REFS = (\"local.\", \"module.\", \"var.\")\n\n\nclass StorageAccountName(BaseResourceCheck):\n    def __init__(self) -> None:\n        name = \"Ensure Storage Accounts adhere to the naming rules\"\n        id = \"CKV_AZURE_43\"\n        supported_resources = [\"azurerm_storage_account\"]\n        categories = [CheckCategories.CONVENTION]\n        super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)\n\n    def scan_resource_conf(self, conf: Dict[str, Any]) -> CheckResult:\n        \"\"\"\n            The Storage Account naming reference:\n            https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview#naming-storage-accounts\n        :param conf: azurerm_storage_account configuration\n        :return: <CheckResult>\n        \"\"\"\n        name = conf.get(\"name\")\n        if name:\n            name = name[0]\n            if any(x in name for x in VARIABLE_REFS):\n                # in the case we couldn't evaluate the name, just ignore\n                return CheckResult.UNKNOWN\n            if re.findall(STO_NAME_REGEX, str(conf[\"name\"][0])):\n                return CheckResult.PASSED\n\n        return CheckResult.FAILED\n\n    def get_evaluated_keys(self) -> List[str]:\n        return [\"name\"]\n\n\ncheck = StorageAccountName()\n", "path": "checkov/terraform/checks/resource/azure/StorageAccountName.py"}]}