azurermHpcCacheBlobNfsTarget
Manages a Blob NFSv3 Target within a HPC Cache.
\~> NOTE:: By request of the service team the provider no longer automatically registering the microsoftStorageCache
Resource Provider for this resource. To register it you can run azProviderRegisterNamespace 'microsoftStorageCache'
.
\~> NOTE:: This resource depends on the NFSv3 enabled Storage Account, which has some prerequisites need to meet. Please checkout: https://docs.microsoft.com/azure/storage/blobs/network-file-system-protocol-support-how-to?tabs=azure-powershell.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azuread from "./.gen/providers/azuread";
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azuread, azurerm.
For a more precise conversion please use the --provider flag in convert.*/
new azuread.provider.AzureadProvider(this, "azuread", {});
new azurerm.provider.AzurermProvider(this, "azurerm", {
features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "west europe",
name: "example-rg",
}
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
this,
"example_3",
{
address_space: ["10.0.0.0/16"],
location: azurermResourceGroupExample.location,
name: "example-vnet",
resource_group_name: azurermResourceGroupExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const dataAzureadServicePrincipalExample =
new azuread.dataAzureadServicePrincipal.DataAzureadServicePrincipal(
this,
"example_4",
{
display_name: "HPC Cache Resource Provider",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAzureadServicePrincipalExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_5", {
address_prefixes: ["10.0.2.0/24"],
name: "example-subnet",
resource_group_name: azurermResourceGroupExample.name,
service_endpoints: ["Microsoft.Storage"],
virtual_network_name: azurermVirtualNetworkExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermHpcCacheExample = new azurerm.hpcCache.HpcCache(
this,
"example_6",
{
cache_size_in_gb: 3072,
location: azurermResourceGroupExample.location,
name: "example-hpc-cache",
resource_group_name: azurermResourceGroupExample.name,
sku_name: "Standard_2G",
subnet_id: azurermSubnetExample.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermHpcCacheExample.overrideLogicalId("example");
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
this,
"example_7",
{
account_kind: "StorageV2",
account_replication_type: "LRS",
account_tier: "Standard",
enable_https_traffic_only: false,
is_hns_enabled: true,
location: azurermResourceGroupExample.location,
name: "examplestorageaccount",
network_rules: [
{
default_action: "Deny",
virtual_network_subnet_ids: [azurermSubnetExample.id],
},
],
nfsv3_enabled: true,
resource_group_name: azurermResourceGroupExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermResourceGroupTemplateDeploymentStorageContainers =
new azurerm.resourceGroupTemplateDeployment.ResourceGroupTemplateDeployment(
this,
"storage-containers",
{
deployment_mode: "Incremental",
name: "example-deployment",
parameters_content:
'${jsonencode({\n location = {\n value = azurerm_storage_account.example.location\n },\n storageAccountName = {\n value = azurerm_storage_account.example.name\n },\n containerName = {\n value = "example-container"\n }\n })}',
resource_group_name: azurermStorageAccountExample.resourceGroupName,
template_content:
'{\n "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",\n "contentVersion": "1.0.0.0",\n "parameters": {\n "storageAccountName": {\n "type": "String"\n },\n "containerName": {\n "type": "String"\n },\n "location": {\n "type": "String"\n }\n },\n "resources": [\n {\n "type": "Microsoft.Storage/storageAccounts",\n "apiVersion": "2019-06-01",\n "name": "[parameters(\'storageAccountName\')]",\n "location": "[parameters(\'location\')]",\n "sku": {\n "name": "Standard_LRS",\n "tier": "Standard"\n },\n "kind": "StorageV2",\n "properties": {\n "accessTier": "Hot"\n },\n "resources": [\n {\n "type": "blobServices/containers",\n "apiVersion": "2019-06-01",\n "name": "[concat(\'default/\', parameters(\'containerName\'))]",\n "dependsOn": [\n "[parameters(\'storageAccountName\')]"\n ]\n }\n ]\n }\n ],\n\n "outputs": {\n "id": {\n "type": "String",\n "value": "[resourceId(\'Microsoft.Storage/storageAccounts/blobServices/containers\', parameters(\'storageAccountName\'), \'default\', parameters(\'containerName\'))]"\n }\n }\n}\n',
}
);
new azurerm.roleAssignment.RoleAssignment(
this,
"example_storage_account_contrib",
{
principal_id: dataAzureadServicePrincipalExample.objectId,
role_definition_name: "Storage Account Contributor",
scope: azurermStorageAccountExample.id,
}
);
new azurerm.roleAssignment.RoleAssignment(
this,
"example_storage_blob_data_contrib",
{
principal_id: dataAzureadServicePrincipalExample.objectId,
role_definition_name: "Storage Blob Data Contributor",
scope: azurermStorageAccountExample.id,
}
);
const azurermHpcCacheBlobNfsTargetExample =
new azurerm.hpcCacheBlobNfsTarget.HpcCacheBlobNfsTarget(this, "example_11", {
cache_name: azurermHpcCacheExample.name,
name: "example-hpc-target",
namespace_path: "/p1",
resource_group_name: azurermResourceGroupExample.name,
storage_container_id: `\${jsondecode(${azurermResourceGroupTemplateDeploymentStorageContainers.outputContent}).id.value}`,
usage_model: "READ_HEAVY_INFREQ",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermHpcCacheBlobNfsTargetExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
cacheName
- (Required) The name of the HPC Cache, which the HPC Cache Blob NFS Target will be added to. Changing this forces a new HPC Cache Blob NFS Target to be created. -
name
- (Required) The name which should be used for this HPC Cache Blob NFS Target. Changing this forces a new HPC Cache Blob NFS Target to be created. -
namespacePath
- (Required) The client-facing file path of the HPC Cache Blob NFS Target. -
resourceGroupName
- (Required) The name of the Resource Group where the HPC Cache Blob NFS Target should exist. Changing this forces a new HPC Cache Blob NFS Target to be created. -
storageContainerId
- (Required) The Resource Manager ID of the Storage Container used as the HPC Cache Blob NFS Target. Changing this forces a new resource to be created.
-> Note: This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the azurermStorageContainer
Data Source/Resource as resourceManagerId
.
usageModel
- (Required) The type of usage of the HPC Cache Blob NFS Target. Possible values are:readHeavyInfreq
,readHeavyCheck180
,writeWorkload15
,writeAround
,writeWorkloadCheck30
,writeWorkloadCheck60
andwriteWorkloadCloudws
.
accessPolicyName
- (Optional) The name of the access policy applied to this target. Defaults todefault
.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the HPC Cache Blob NFS Target.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the HPC Cache Blob NFS Target.read
- (Defaults to 5 minutes) Used when retrieving the HPC Cache Blob NFS Target.update
- (Defaults to 30 minutes) Used when updating the HPC Cache Blob NFS Target.delete
- (Defaults to 30 minutes) Used when deleting the HPC Cache Blob NFS Target.
Import
HPC Cache Blob NFS Targets can be imported using the resourceId
, e.g.