From 43772b298ac9e2c111e061488e889f9554dceb80 Mon Sep 17 00:00:00 2001 From: sansns-aws Date: Mon, 21 Oct 2024 15:32:12 +0000 Subject: [PATCH 1/2] feat(fsx) - Windows File System Multi AZ --- .../providers/aws/services/fsx/fsx_service.py | 2 + .../__init__.py | 0 ...windows_file_system_multi_az.metadata.json | 32 ++++ .../fsx_windows_file_system_multi_az.py | 25 +++ .../aws/services/fsx/fsx_service_test.py | 3 +- .../fsx_windows_file_system_multi_az_test.py | 144 ++++++++++++++++++ 6 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/__init__.py create mode 100644 prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json create mode 100644 prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py create mode 100644 tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py diff --git a/prowler/providers/aws/services/fsx/fsx_service.py b/prowler/providers/aws/services/fsx/fsx_service.py index 06c2763ad4b..6120bb09631 100644 --- a/prowler/providers/aws/services/fsx/fsx_service.py +++ b/prowler/providers/aws/services/fsx/fsx_service.py @@ -51,6 +51,7 @@ def _describe_file_systems(self, regional_client): type=file_system["FileSystemType"], copy_tags_to_backups=copy_tags_to_backups_aux, copy_tags_to_volumes=copy_tags_to_volumes_aux, + subnet_id=file_system.get("SubnetIds"), region=regional_client.region, tags=file_system.get("Tags", []), ) @@ -67,4 +68,5 @@ class FileSystem(BaseModel): type: str copy_tags_to_backups: Optional[bool] copy_tags_to_volumes: Optional[bool] + subnet_id: Optional[list] = [] tags: Optional[list] = [] diff --git a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/__init__.py b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json new file mode 100644 index 00000000000..5f0e10a8931 --- /dev/null +++ b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json @@ -0,0 +1,32 @@ +{ + "Provider": "aws", + "CheckID": "fsx_windows_file_system_multi_az", + "CheckTitle": "Check if FSx Windows file systems are configured with Multi AZ.", + "CheckType": [ + "Resiliance" + ], + "ServiceName": "fsx", + "SubServiceName": "", + "ResourceIdTemplate": "arn:aws:fsx:{region}:{account-id}:file-system/{file-system-id}", + "Severity": "low", + "ResourceType": "AwsFSxFileSystem", + "Description": "Check if FSx Windows file systems are configured with Multi AZ. The control fails if this configuration isn't enabled.", + "Risk": "Relative to Single-AZ deployment, Multi-AZ deployments provide enhanced durability by further replicating data across AZs, and enhanced availability during planned system maintenance and unplanned service disruption by failing over automatically to the standby AZ. This allows you to continue accessing your data, and helps to protect your data against instance failure and AZ disruption.", + "RelatedUrl": "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/high-availability-multiAZ.html", + "Remediation": { + "Code": { + "CLI": "", + "NativeIaC": "", + "Other": "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/high-availability-multiAZ.html", + "Terraform": "" + }, + "Recommendation": { + "Text": "Configure your FSx Windows file system to be highly available with ENIs in Multiple AZs.", + "Url": "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/high-availability-multiAZ.html" + } + }, + "Categories": [], + "DependsOn": [], + "RelatedTo": [], + "Notes": "" +} diff --git a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py new file mode 100644 index 00000000000..6e12cb66862 --- /dev/null +++ b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py @@ -0,0 +1,25 @@ +from prowler.lib.check.models import Check, Check_Report_AWS +from prowler.providers.aws.services.fsx.fsx_client import fsx_client + + +class fsx_windows_file_system_multi_az(Check): + def execute(self): + findings = [] + for file_system in fsx_client.file_systems.values(): + if file_system.type == "WINDOWS": + report = Check_Report_AWS(self.metadata()) + report.region = file_system.region + report.resource_id = file_system.id + report.resource_arn = file_system.arn + report.resource_tags = file_system.tags + if len(file_system.subnet_id) > 1: + report.status = "PASS" + report.status_extended = f"FSx Windows file system {file_system.id} is configured for multi AZ deployment." + + else: + report.status = "FAIL" + report.status_extended = f"FSx Windows file system {file_system.id} is not configured for multi AZ deployment." + + findings.append(report) + + return findings diff --git a/tests/providers/aws/services/fsx/fsx_service_test.py b/tests/providers/aws/services/fsx/fsx_service_test.py index 6c440145568..c33beb7d63b 100644 --- a/tests/providers/aws/services/fsx/fsx_service_test.py +++ b/tests/providers/aws/services/fsx/fsx_service_test.py @@ -56,7 +56,7 @@ def test_describe_file_systems(self): StorageCapacity=1200, LustreConfiguration={"CopyTagsToBackups": True}, Tags=[{"Key": "Name", "Value": "Test"}], - SubnetIds=["subnet-12345678"], + SubnetIds=["subnet-12345678", "subnet-12345670"], ) arn = f"arn:aws:fsx:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:file-system/{file_system['FileSystem']['FileSystemId']}" aws_provider = set_mocked_aws_provider([AWS_REGION_US_EAST_1]) @@ -67,3 +67,4 @@ def test_describe_file_systems(self): assert fsx.file_systems[arn].copy_tags_to_backups assert fsx.file_systems[arn].region == AWS_REGION_US_EAST_1 assert fsx.file_systems[arn].tags == [{"Key": "Name", "Value": "Test"}] + assert fsx.file_systems[arn].subnet_id == file_system["FileSystem"]["SubnetIds"] diff --git a/tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py b/tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py new file mode 100644 index 00000000000..6986ac8a63e --- /dev/null +++ b/tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py @@ -0,0 +1,144 @@ +from unittest import mock + +from boto3 import client +from moto import mock_aws + +from prowler.providers.aws.services.fsx.fsx_service import FSx +from tests.providers.aws.utils import AWS_REGION_EU_WEST_1, set_mocked_aws_provider + + +class Test_fsx_windows_file_system_multi_az: + @mock_aws + def test_fsx_no_file_system(self): + client("fsx", region_name=AWS_REGION_EU_WEST_1) + + aws_provider = set_mocked_aws_provider([AWS_REGION_EU_WEST_1]) + + with mock.patch( + "prowler.providers.common.provider.Provider.get_global_provider", + return_value=aws_provider, + ), mock.patch( + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + new=FSx(aws_provider), + ): + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( + fsx_windows_file_system_multi_az, + ) + + check = fsx_windows_file_system_multi_az() + result = check.execute() + assert len(result) == 0 + + @mock_aws + def test_fsx_file_system_not_windows(self): + fsx_client = client("fsx", region_name=AWS_REGION_EU_WEST_1) + fsx_client.create_file_system( + FileSystemType="LUSTRE", + StorageCapacity=1200, + LustreConfiguration={"CopyTagsToBackups": True}, + Tags=[{"Key": "Name", "Value": "Test"}], + SubnetIds=["subnet-12345678"], + ) + + aws_provider = set_mocked_aws_provider([AWS_REGION_EU_WEST_1]) + + with mock.patch( + "prowler.providers.common.provider.Provider.get_global_provider", + return_value=aws_provider, + ), mock.patch( + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + new=FSx(aws_provider), + ): + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( + fsx_windows_file_system_multi_az, + ) + + check = fsx_windows_file_system_multi_az() + result = check.execute() + assert len(result) == 0 + + @mock_aws + def test_fsx_windows_not_multi_az(self): + fsx_client = client("fsx", region_name=AWS_REGION_EU_WEST_1) + file_system = fsx_client.create_file_system( + FileSystemType="WINDOWS", + StorageCapacity=1200, + OpenZFSConfiguration={ + "CopyTagsToVolumes": False, + "DeploymentType": "SINGLE_AZ_1", + "ThroughputCapacity": 12, + }, + Tags=[{"Key": "Name", "Value": "Test"}], + SubnetIds=["subnet-12345678"], + ) + + aws_provider = set_mocked_aws_provider([AWS_REGION_EU_WEST_1]) + + with mock.patch( + "prowler.providers.common.provider.Provider.get_global_provider", + return_value=aws_provider, + ), mock.patch( + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + new=FSx(aws_provider), + ): + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( + fsx_windows_file_system_multi_az, + ) + + check = fsx_windows_file_system_multi_az() + result = check.execute() + assert len(result) == 1 + assert result[0].status == "FAIL" + assert ( + result[0].status_extended + == f"FSx Windows file system {file_system['FileSystem']['FileSystemId']} is not configured for multi AZ deployment." + ) + assert result[0].resource_id == file_system["FileSystem"]["FileSystemId"] + assert ( + result[0].resource_arn + == f"arn:aws:fsx:{AWS_REGION_EU_WEST_1}:123456789012:file-system/{file_system['FileSystem']['FileSystemId']}" + ) + assert result[0].region == AWS_REGION_EU_WEST_1 + + @mock_aws + def test_fsx_windows_multi_az(self): + fsx_client = client("fsx", region_name=AWS_REGION_EU_WEST_1) + file_system = fsx_client.create_file_system( + FileSystemType="WINDOWS", + StorageCapacity=1200, + OpenZFSConfiguration={ + "CopyTagsToVolumes": True, + "DeploymentType": "MULTI_AZ_1", + "ThroughputCapacity": 12, + }, + Tags=[{"Key": "Name", "Value": "Test"}], + SubnetIds=["subnet-12345678", "subnet-12345670"], + ) + + aws_provider = set_mocked_aws_provider([AWS_REGION_EU_WEST_1]) + + with mock.patch( + "prowler.providers.common.provider.Provider.get_global_provider", + return_value=aws_provider, + ), mock.patch( + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + new=FSx(aws_provider), + ): + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( + fsx_windows_file_system_multi_az, + ) + + check = fsx_windows_file_system_multi_az() + result = check.execute() + assert len(result) == 1 + assert result[0].status == "PASS" + assert ( + result[0].status_extended + == f"FSx Windows file system {file_system['FileSystem']['FileSystemId']} is configured for multi AZ deployment." + ) + assert result[0].resource_id == file_system["FileSystem"]["FileSystemId"] + assert ( + result[0].resource_arn + == f"arn:aws:fsx:{AWS_REGION_EU_WEST_1}:123456789012:file-system/{file_system['FileSystem']['FileSystemId']}" + ) + assert result[0].region == AWS_REGION_EU_WEST_1 From f7507e8f32c74b4df258655c0ffc35e147eed0b5 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 23 Oct 2024 12:40:29 -0700 Subject: [PATCH 2/2] chore: revision --- .../providers/aws/services/fsx/fsx_service.py | 4 +-- .../__init__.py | 0 ...ile_system_multi_az_enabled.metadata.json} | 16 ++++----- ...x_windows_file_system_multi_az_enabled.py} | 8 ++--- .../fsx_file_system_multi_az_enabled_test.py} | 36 +++++++++---------- .../aws/services/fsx/fsx_service_test.py | 4 ++- 6 files changed, 35 insertions(+), 33 deletions(-) rename prowler/providers/aws/services/fsx/{fsx_windows_file_system_multi_az => fsx_windows_file_system_multi_az_enabled}/__init__.py (100%) rename prowler/providers/aws/services/fsx/{fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json => fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.metadata.json} (81%) rename prowler/providers/aws/services/fsx/{fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py => fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.py} (78%) rename tests/providers/aws/services/fsx/{fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py => fsx_file_system_multi_az_enabled/fsx_file_system_multi_az_enabled_test.py} (79%) diff --git a/prowler/providers/aws/services/fsx/fsx_service.py b/prowler/providers/aws/services/fsx/fsx_service.py index 6120bb09631..7366204eca1 100644 --- a/prowler/providers/aws/services/fsx/fsx_service.py +++ b/prowler/providers/aws/services/fsx/fsx_service.py @@ -51,7 +51,7 @@ def _describe_file_systems(self, regional_client): type=file_system["FileSystemType"], copy_tags_to_backups=copy_tags_to_backups_aux, copy_tags_to_volumes=copy_tags_to_volumes_aux, - subnet_id=file_system.get("SubnetIds"), + subnet_ids=file_system.get("SubnetIds", []), region=regional_client.region, tags=file_system.get("Tags", []), ) @@ -68,5 +68,5 @@ class FileSystem(BaseModel): type: str copy_tags_to_backups: Optional[bool] copy_tags_to_volumes: Optional[bool] - subnet_id: Optional[list] = [] + subnet_ids: Optional[list] = [] tags: Optional[list] = [] diff --git a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/__init__.py b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/__init__.py similarity index 100% rename from prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/__init__.py rename to prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/__init__.py diff --git a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.metadata.json similarity index 81% rename from prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json rename to prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.metadata.json index 5f0e10a8931..633021a0cc1 100644 --- a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.metadata.json +++ b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.metadata.json @@ -1,23 +1,21 @@ { "Provider": "aws", - "CheckID": "fsx_windows_file_system_multi_az", - "CheckTitle": "Check if FSx Windows file systems are configured with Multi AZ.", - "CheckType": [ - "Resiliance" - ], + "CheckID": "fsx_windows_file_system_multi_az_enabled", + "CheckTitle": "Check if FSx Windows file systems are configured with Multi-AZ.", + "CheckType": [], "ServiceName": "fsx", "SubServiceName": "", "ResourceIdTemplate": "arn:aws:fsx:{region}:{account-id}:file-system/{file-system-id}", "Severity": "low", "ResourceType": "AwsFSxFileSystem", - "Description": "Check if FSx Windows file systems are configured with Multi AZ. The control fails if this configuration isn't enabled.", + "Description": "Check if FSx Windows file systems are configured with Multi-AZ. The control fails if this configuration isn't enabled.", "Risk": "Relative to Single-AZ deployment, Multi-AZ deployments provide enhanced durability by further replicating data across AZs, and enhanced availability during planned system maintenance and unplanned service disruption by failing over automatically to the standby AZ. This allows you to continue accessing your data, and helps to protect your data against instance failure and AZ disruption.", "RelatedUrl": "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/high-availability-multiAZ.html", "Remediation": { "Code": { "CLI": "", "NativeIaC": "", - "Other": "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/high-availability-multiAZ.html", + "Other": "", "Terraform": "" }, "Recommendation": { @@ -25,7 +23,9 @@ "Url": "https://docs.aws.amazon.com/fsx/latest/WindowsGuide/high-availability-multiAZ.html" } }, - "Categories": [], + "Categories": [ + "redundancy" + ], "DependsOn": [], "RelatedTo": [], "Notes": "" diff --git a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.py similarity index 78% rename from prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py rename to prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.py index 6e12cb66862..f0c6c3990f7 100644 --- a/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az.py +++ b/prowler/providers/aws/services/fsx/fsx_windows_file_system_multi_az_enabled/fsx_windows_file_system_multi_az_enabled.py @@ -2,7 +2,7 @@ from prowler.providers.aws.services.fsx.fsx_client import fsx_client -class fsx_windows_file_system_multi_az(Check): +class fsx_windows_file_system_multi_az_enabled(Check): def execute(self): findings = [] for file_system in fsx_client.file_systems.values(): @@ -12,13 +12,13 @@ def execute(self): report.resource_id = file_system.id report.resource_arn = file_system.arn report.resource_tags = file_system.tags - if len(file_system.subnet_id) > 1: + if len(file_system.subnet_ids) > 1: report.status = "PASS" - report.status_extended = f"FSx Windows file system {file_system.id} is configured for multi AZ deployment." + report.status_extended = f"FSx Windows file system {file_system.id} is configured for Multi-AZ deployment." else: report.status = "FAIL" - report.status_extended = f"FSx Windows file system {file_system.id} is not configured for multi AZ deployment." + report.status_extended = f"FSx Windows file system {file_system.id} is not configured for Multi-AZ deployment." findings.append(report) diff --git a/tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py b/tests/providers/aws/services/fsx/fsx_file_system_multi_az_enabled/fsx_file_system_multi_az_enabled_test.py similarity index 79% rename from tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py rename to tests/providers/aws/services/fsx/fsx_file_system_multi_az_enabled/fsx_file_system_multi_az_enabled_test.py index 6986ac8a63e..a4b6bdf0006 100644 --- a/tests/providers/aws/services/fsx/fsx_windows_file_system_multi_az/fsx_windows_file_system_multi_az_test.py +++ b/tests/providers/aws/services/fsx/fsx_file_system_multi_az_enabled/fsx_file_system_multi_az_enabled_test.py @@ -18,14 +18,14 @@ def test_fsx_no_file_system(self): "prowler.providers.common.provider.Provider.get_global_provider", return_value=aws_provider, ), mock.patch( - "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled.fsx_client", new=FSx(aws_provider), ): - from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( - fsx_windows_file_system_multi_az, + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled import ( + fsx_windows_file_system_multi_az_enabled, ) - check = fsx_windows_file_system_multi_az() + check = fsx_windows_file_system_multi_az_enabled() result = check.execute() assert len(result) == 0 @@ -46,14 +46,14 @@ def test_fsx_file_system_not_windows(self): "prowler.providers.common.provider.Provider.get_global_provider", return_value=aws_provider, ), mock.patch( - "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled.fsx_client", new=FSx(aws_provider), ): - from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( - fsx_windows_file_system_multi_az, + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled import ( + fsx_windows_file_system_multi_az_enabled, ) - check = fsx_windows_file_system_multi_az() + check = fsx_windows_file_system_multi_az_enabled() result = check.execute() assert len(result) == 0 @@ -78,20 +78,20 @@ def test_fsx_windows_not_multi_az(self): "prowler.providers.common.provider.Provider.get_global_provider", return_value=aws_provider, ), mock.patch( - "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled.fsx_client", new=FSx(aws_provider), ): - from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( - fsx_windows_file_system_multi_az, + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled import ( + fsx_windows_file_system_multi_az_enabled, ) - check = fsx_windows_file_system_multi_az() + check = fsx_windows_file_system_multi_az_enabled() result = check.execute() assert len(result) == 1 assert result[0].status == "FAIL" assert ( result[0].status_extended - == f"FSx Windows file system {file_system['FileSystem']['FileSystemId']} is not configured for multi AZ deployment." + == f"FSx Windows file system {file_system['FileSystem']['FileSystemId']} is not configured for Multi-AZ deployment." ) assert result[0].resource_id == file_system["FileSystem"]["FileSystemId"] assert ( @@ -121,20 +121,20 @@ def test_fsx_windows_multi_az(self): "prowler.providers.common.provider.Provider.get_global_provider", return_value=aws_provider, ), mock.patch( - "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az.fsx_client", + "prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled.fsx_client", new=FSx(aws_provider), ): - from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az.fsx_windows_file_system_multi_az import ( - fsx_windows_file_system_multi_az, + from prowler.providers.aws.services.fsx.fsx_windows_file_system_multi_az_enabled.fsx_windows_file_system_multi_az_enabled import ( + fsx_windows_file_system_multi_az_enabled, ) - check = fsx_windows_file_system_multi_az() + check = fsx_windows_file_system_multi_az_enabled() result = check.execute() assert len(result) == 1 assert result[0].status == "PASS" assert ( result[0].status_extended - == f"FSx Windows file system {file_system['FileSystem']['FileSystemId']} is configured for multi AZ deployment." + == f"FSx Windows file system {file_system['FileSystem']['FileSystemId']} is configured for Multi-AZ deployment." ) assert result[0].resource_id == file_system["FileSystem"]["FileSystemId"] assert ( diff --git a/tests/providers/aws/services/fsx/fsx_service_test.py b/tests/providers/aws/services/fsx/fsx_service_test.py index c33beb7d63b..6d31ed363d4 100644 --- a/tests/providers/aws/services/fsx/fsx_service_test.py +++ b/tests/providers/aws/services/fsx/fsx_service_test.py @@ -67,4 +67,6 @@ def test_describe_file_systems(self): assert fsx.file_systems[arn].copy_tags_to_backups assert fsx.file_systems[arn].region == AWS_REGION_US_EAST_1 assert fsx.file_systems[arn].tags == [{"Key": "Name", "Value": "Test"}] - assert fsx.file_systems[arn].subnet_id == file_system["FileSystem"]["SubnetIds"] + assert ( + fsx.file_systems[arn].subnet_ids == file_system["FileSystem"]["SubnetIds"] + )