Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class StorageAccountMinimumTlsVersion(BaseResourceCheck):
def __init__(self) -> None:
"""
Looks for min_tls_version configuration at azurerm_storage_account to be set to TLS1_2
Looks for min_tls_version configuration at azurerm_storage_account to be set to TLS1_2 or TLS1_3
https://www.terraform.io/docs/providers/azurerm/r/storage_account.html#min_tls_version
:param conf: azurerm_storage_account configuration
:return: <CheckResult>
Expand All @@ -24,7 +24,7 @@ def __init__(self) -> None:
def scan_resource_conf(self, conf: dict[str, Any]) -> CheckResult:
if "properties" in conf and \
"minimumTlsVersion" in conf["properties"] and \
conf["properties"]["minimumTlsVersion"] in ['TLS1_2']:
conf["properties"]["minimumTlsVersion"] in ['TLS1_2', 'TLS1_3']:
return CheckResult.PASSED
return CheckResult.FAILED

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_ZRS",
"Premium_LRS"
],
"metadata": {
"description": "Storage Account type"
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"storageAccountName": "[concat('store', uniquestring(resourceGroup().id))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-04-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('storageAccountType')]"
},
"kind": "StorageV2",
"properties": {
"minimumTlsVersion": "TLS1_3",
"supportsHttpsTrafficOnly": true,
"networkAcls": {
"defaultAction": "Deny",
"bypass": "AzureServices"
}
}
}
],
"outputs": {
"storageAccountName": {
"type": "string",
"value": "[variables('storageAccountName')]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_summary(self):
test_files_dir = current_dir + "/example_StorageAccountMinimumTlsVersion"
report = runner.run(root_folder=test_files_dir, runner_filter=RunnerFilter(checks=[check.id]))
summary = report.get_summary()
self.assertEqual(summary['passed'], 1)
self.assertEqual(summary['passed'], 2)
self.assertEqual(summary['failed'], 3)
self.assertEqual(summary['skipped'], 0)
self.assertEqual(summary['parsing_errors'], 0)
Expand Down