Repository: bridgecrewio/checkov

Issue:
False positive for CKV_AZURE_43 when using the "random" provider resources
**Describe the issue**
Check ID: CKV_AZURE_43
When using any of the random_* resources from the [random provider](https://registry.terraform.io/providers/hashicorp/random/latest/docs) check CKV_AZURE_43 fails.

StorageAccountName.py probably needs the VARIABLE_REFS list expanded to include the random_* resources.

**Examples**
```
resource "random_string" "random" {
  length  = 4
  number  = true
  lower   = false
  special = false
  upper   = false
}

resource "azurerm_storage_account" "vmstorageaccount" {
  name                      = "storage${random_string.random}"
  ....
}
```

**Version:**
 - Checkov Version 2.0.113


Discussion:

Resolving patch:
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
@@ -5,7 +5,7 @@
 from checkov.common.models.enums import CheckResult, CheckCategories
 
 STO_NAME_REGEX = re.compile(r"^[a-z0-9]{3,24}$")
-VARIABLE_REFS = ("local.", "module.", "var.")
+VARIABLE_REFS = ("local.", "module.", "var.", "random_string.", "random_id.", "random_integer.", "random_pet.")
 
 
 class StorageAccountName(BaseResourceCheck):


Test patch:
diff --git a/tests/terraform/checks/resource/azure/example_StorageAccountName/main.tf b/tests/terraform/checks/resource/azure/example_StorageAccountName/main.tf
--- a/tests/terraform/checks/resource/azure/example_StorageAccountName/main.tf
+++ b/tests/terraform/checks/resource/azure/example_StorageAccountName/main.tf
@@ -67,3 +67,35 @@ resource "azurerm_storage_account" "var" {
   account_tier             = "Standard"
   account_replication_type = "GRS"
 }
+
+resource "azurerm_storage_account" "random_string" {
+  name                     = "${random_string.prefix}example"
+  resource_group_name      = "azurerm_resource_group.example.name"
+  location                 = "azurerm_resource_group.example.location"
+  account_tier             = "Standard"
+  account_replication_type = "GRS"
+}
+
+resource "azurerm_storage_account" "random_id" {
+  name                     = "${random_id.prefix}example"
+  resource_group_name      = "azurerm_resource_group.example.name"
+  location                 = "azurerm_resource_group.example.location"
+  account_tier             = "Standard"
+  account_replication_type = "GRS"
+}
+
+resource "azurerm_storage_account" "random_pet" {
+  name                     = "${random_pet.prefix}example"
+  resource_group_name      = "azurerm_resource_group.example.name"
+  location                 = "azurerm_resource_group.example.location"
+  account_tier             = "Standard"
+  account_replication_type = "GRS"
+}
+
+resource "azurerm_storage_account" "random_integer" {
+  name                     = "${random_integer.prefix}example"
+  resource_group_name      = "azurerm_resource_group.example.name"
+  location                 = "azurerm_resource_group.example.location"
+  account_tier             = "Standard"
+  account_replication_type = "GRS"
+}
diff --git a/tests/terraform/checks/resource/azure/test_StorageAccountName.py b/tests/terraform/checks/resource/azure/test_StorageAccountName.py
--- a/tests/terraform/checks/resource/azure/test_StorageAccountName.py
+++ b/tests/terraform/checks/resource/azure/test_StorageAccountName.py
@@ -34,7 +34,7 @@ def test(self):
         self.assertEqual(summary["failed"], 3)
         self.assertEqual(summary["skipped"], 0)
         self.assertEqual(summary["parsing_errors"], 0)
-        self.assertEqual(summary["resource_count"], 8)  # 3 unknown
+        self.assertEqual(summary["resource_count"], 12)  # 7 unknown
 
         self.assertEqual(passing_resources, passed_check_resources)
         self.assertEqual(failing_resources, failed_check_resources)