-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2115 from alan-turing-institute/ansible_vars_file
Add ansible vars file
- Loading branch information
Showing
22 changed files
with
531 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
data_safe_haven/infrastructure/components/composite/nfsv3_blob_container.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
from pulumi import ComponentResource, Input, ResourceOptions | ||
from pulumi_azure_native import storage | ||
|
||
from data_safe_haven.infrastructure.components.dynamic.blob_container_acl import ( | ||
BlobContainerAcl, | ||
BlobContainerAclProps, | ||
) | ||
|
||
|
||
class NFSV3BlobContainerProps: | ||
def __init__( | ||
self, | ||
acl_user: Input[str], | ||
acl_group: Input[str], | ||
acl_other: Input[str], | ||
apply_default_permissions: Input[bool], | ||
container_name: Input[str], | ||
resource_group_name: Input[str], | ||
storage_account: Input[storage.StorageAccount], | ||
subscription_name: Input[str], | ||
): | ||
self.acl_user = acl_user | ||
self.acl_group = acl_group | ||
self.acl_other = acl_other | ||
self.apply_default_permissions = apply_default_permissions | ||
self.container_name = container_name | ||
self.resource_group_name = resource_group_name | ||
self.storage_account = storage_account | ||
self.subscription_name = subscription_name | ||
|
||
|
||
class NFSV3BlobContainerComponent(ComponentResource): | ||
def __init__( | ||
self, | ||
name: str, | ||
props: NFSV3BlobContainerProps, | ||
opts: ResourceOptions | None = None, | ||
): | ||
super().__init__("dsh:common:NFSV3BlobContainerComponent", name, {}, opts) | ||
child_opts = ResourceOptions.merge(opts, ResourceOptions(parent=self)) | ||
|
||
storage_container = storage.BlobContainer( | ||
f"{self._name}_blob_container_{props.container_name}", | ||
account_name=props.storage_account.name, | ||
container_name=props.container_name, | ||
default_encryption_scope="$account-encryption-key", | ||
deny_encryption_scope_override=False, | ||
public_access=storage.PublicAccess.NONE, | ||
resource_group_name=props.resource_group_name, | ||
opts=ResourceOptions.merge( | ||
child_opts, | ||
ResourceOptions(parent=props.storage_account), | ||
), | ||
) | ||
BlobContainerAcl( | ||
f"{storage_container._name}_acl", | ||
BlobContainerAclProps( | ||
acl_user=props.acl_user, | ||
acl_group=props.acl_group, | ||
acl_other=props.acl_other, | ||
apply_default_permissions=props.apply_default_permissions, | ||
container_name=storage_container.name, | ||
resource_group_name=props.resource_group_name, | ||
storage_account_name=props.storage_account.name, | ||
subscription_name=props.subscription_name, | ||
), | ||
opts=ResourceOptions.merge( | ||
child_opts, | ||
ResourceOptions(parent=props.storage_account), | ||
), | ||
) | ||
|
||
self.name = storage_container.name | ||
|
||
self.register_outputs({}) |
2 changes: 2 additions & 0 deletions
2
data_safe_haven/infrastructure/components/wrapped/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from .log_analytics_workspace import WrappedLogAnalyticsWorkspace | ||
from .nfsv3_storage_account import WrappedNFSV3StorageAccount | ||
|
||
__all__ = [ | ||
"WrappedNFSV3StorageAccount", | ||
"WrappedLogAnalyticsWorkspace", | ||
] |
68 changes: 68 additions & 0 deletions
68
data_safe_haven/infrastructure/components/wrapped/nfsv3_storage_account.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from collections.abc import Mapping, Sequence | ||
|
||
from pulumi import Input, Output, ResourceOptions | ||
from pulumi_azure_native import storage | ||
|
||
from data_safe_haven.external import AzureIPv4Range | ||
|
||
|
||
class WrappedNFSV3StorageAccount(storage.StorageAccount): | ||
encryption_args = storage.EncryptionArgs( | ||
key_source=storage.KeySource.MICROSOFT_STORAGE, | ||
services=storage.EncryptionServicesArgs( | ||
blob=storage.EncryptionServiceArgs( | ||
enabled=True, key_type=storage.KeyType.ACCOUNT | ||
), | ||
file=storage.EncryptionServiceArgs( | ||
enabled=True, key_type=storage.KeyType.ACCOUNT | ||
), | ||
), | ||
) | ||
|
||
def __init__( | ||
self, | ||
resource_name: str, | ||
*, | ||
account_name: Input[str], | ||
allowed_ip_addresses: Input[Sequence[str]], | ||
location: Input[str], | ||
resource_group_name: Input[str], | ||
subnet_id: Input[str], | ||
opts: ResourceOptions, | ||
tags: Input[Mapping[str, Input[str]]], | ||
): | ||
self.resource_group_name_ = Output.from_input(resource_group_name) | ||
super().__init__( | ||
resource_name, | ||
account_name=account_name, | ||
enable_https_traffic_only=True, | ||
enable_nfs_v3=True, | ||
encryption=self.encryption_args, | ||
is_hns_enabled=True, | ||
kind=storage.Kind.BLOCK_BLOB_STORAGE, | ||
location=location, | ||
minimum_tls_version=storage.MinimumTlsVersion.TLS1_2, | ||
network_rule_set=storage.NetworkRuleSetArgs( | ||
bypass=storage.Bypass.AZURE_SERVICES, | ||
default_action=storage.DefaultAction.DENY, | ||
ip_rules=Output.from_input(allowed_ip_addresses).apply( | ||
lambda ip_ranges: [ | ||
storage.IPRuleArgs( | ||
action=storage.Action.ALLOW, | ||
i_p_address_or_range=str(ip_address), | ||
) | ||
for ip_range in sorted(ip_ranges) | ||
for ip_address in AzureIPv4Range.from_cidr(ip_range).all_ips() | ||
] | ||
), | ||
virtual_network_rules=[ | ||
storage.VirtualNetworkRuleArgs( | ||
virtual_network_resource_id=subnet_id, | ||
) | ||
], | ||
), | ||
resource_group_name=resource_group_name, | ||
sku=storage.SkuArgs(name=storage.SkuName.PREMIUM_ZRS), | ||
opts=opts, | ||
tags=tags, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.