|
17 | 17 | storage, |
18 | 18 | ) |
19 | 19 |
|
20 | | -from data_safe_haven.external import AzureIPv4Range |
21 | 20 | from data_safe_haven.functions import ( |
22 | 21 | alphanumeric, |
23 | 22 | replace_separators, |
|
32 | 31 | from data_safe_haven.infrastructure.components import ( |
33 | 32 | BlobContainerAcl, |
34 | 33 | BlobContainerAclProps, |
| 34 | + NFSV3StorageAccount, |
35 | 35 | ) |
36 | 36 | from data_safe_haven.resources import resources_path |
37 | 37 | from data_safe_haven.types import AzureDnsZoneNames |
@@ -84,49 +84,15 @@ def __init__( |
84 | 84 | # Deploy desired state storage account |
85 | 85 | # - This holds the /desired_state container that is mounted by workspaces |
86 | 86 | # - Azure blobs have worse NFS support but can be accessed with Azure Storage Explorer |
87 | | - storage_account = storage.StorageAccount( |
| 87 | + storage_account = NFSV3StorageAccount( |
88 | 88 | f"{self._name}_storage_account", |
89 | | - # Storage account names have a maximum of 24 characters |
90 | 89 | account_name=alphanumeric( |
91 | 90 | f"{''.join(truncate_tokens(stack_name.split('-'), 11))}desiredstate{sha256hash(self._name)}" |
92 | 91 | )[:24], |
93 | | - enable_https_traffic_only=True, |
94 | | - enable_nfs_v3=True, |
95 | | - encryption=storage.EncryptionArgs( |
96 | | - key_source=storage.KeySource.MICROSOFT_STORAGE, |
97 | | - services=storage.EncryptionServicesArgs( |
98 | | - blob=storage.EncryptionServiceArgs( |
99 | | - enabled=True, key_type=storage.KeyType.ACCOUNT |
100 | | - ), |
101 | | - file=storage.EncryptionServiceArgs( |
102 | | - enabled=True, key_type=storage.KeyType.ACCOUNT |
103 | | - ), |
104 | | - ), |
105 | | - ), |
106 | | - kind=storage.Kind.BLOCK_BLOB_STORAGE, |
107 | | - is_hns_enabled=True, |
| 92 | + allowed_ip_addresses=props.admin_ip_addresses, |
108 | 93 | location=props.location, |
109 | | - network_rule_set=storage.NetworkRuleSetArgs( |
110 | | - bypass=storage.Bypass.AZURE_SERVICES, |
111 | | - default_action=storage.DefaultAction.DENY, |
112 | | - ip_rules=Output.from_input(props.admin_ip_addresses).apply( |
113 | | - lambda ip_ranges: [ |
114 | | - storage.IPRuleArgs( |
115 | | - action=storage.Action.ALLOW, |
116 | | - i_p_address_or_range=str(ip_address), |
117 | | - ) |
118 | | - for ip_range in sorted(ip_ranges) |
119 | | - for ip_address in AzureIPv4Range.from_cidr(ip_range).all_ips() |
120 | | - ] |
121 | | - ), |
122 | | - virtual_network_rules=[ |
123 | | - storage.VirtualNetworkRuleArgs( |
124 | | - virtual_network_resource_id=props.subnet_desired_state_id, |
125 | | - ) |
126 | | - ], |
127 | | - ), |
128 | 94 | resource_group_name=props.resource_group_name, |
129 | | - sku=storage.SkuArgs(name=storage.SkuName.PREMIUM_ZRS), |
| 95 | + subnet_id=props.subnet_desired_state_id, |
130 | 96 | opts=child_opts, |
131 | 97 | tags=child_tags, |
132 | 98 | ) |
|
0 commit comments