Skip to content

azurermDataShareDatasetBlobStorage

Manages a Data Share Blob Storage Dataset.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
import * as azuread from "./.gen/providers/azuread";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm, azuread.
For a more precise conversion please use the --provider flag in convert.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
  features: [{}],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_2",
  {
    account_replication_type: "RAGRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplestr",
    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 azurermStorageContainerExample =
  new azurerm.storageContainer.StorageContainer(this, "example_3", {
    container_access_type: "container",
    name: "example-sc",
    storage_account_name: azurermStorageAccountExample.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.*/
azurermStorageContainerExample.overrideLogicalId("example");
const azurermDataShareAccountExample =
  new azurerm.dataShareAccount.DataShareAccount(this, "example_4", {
    identity: [
      {
        type: "SystemAssigned",
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "example-dsa",
    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.*/
azurermDataShareAccountExample.overrideLogicalId("example");
const dataAzureadServicePrincipalExample =
  new azuread.dataAzureadServicePrincipal.DataAzureadServicePrincipal(
    this,
    "example_5",
    {
      display_name: azurermDataShareAccountExample.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.*/
dataAzureadServicePrincipalExample.overrideLogicalId("example");
const azurermDataShareExample = new azurerm.dataShare.DataShare(
  this,
  "example_6",
  {
    account_id: azurermDataShareAccountExample.id,
    kind: "CopyBased",
    name: "example_ds",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataShareExample.overrideLogicalId("example");
const azurermRoleAssignmentExample = new azurerm.roleAssignment.RoleAssignment(
  this,
  "example_7",
  {
    principal_id: dataAzureadServicePrincipalExample.objectId,
    role_definition_name: "Storage Blob Data Reader",
    scope: azurermStorageAccountExample.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.*/
azurermRoleAssignmentExample.overrideLogicalId("example");
const azurermDataShareDatasetBlobStorageExample =
  new azurerm.dataShareDatasetBlobStorage.DataShareDatasetBlobStorage(
    this,
    "example_8",
    {
      container_name: azurermStorageContainerExample.name,
      data_share_id: azurermDataShareExample.id,
      depends_on: [`\${${azurermRoleAssignmentExample.fqn}}`],
      file_path: "myfile.txt",
      name: "example-dsbsds-file",
      storage_account: [
        {
          name: azurermStorageAccountExample.name,
          resource_group_name: azurermStorageAccountExample.resourceGroupName,
          subscription_id: "00000000-0000-0000-0000-000000000000",
        },
      ],
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDataShareDatasetBlobStorageExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Data Share Blob Storage Dataset. Changing this forces a new Data Share Blob Storage Dataset to be created.

  • dataShareId - (Required) The ID of the Data Share in which this Data Share Blob Storage Dataset should be created. Changing this forces a new Data Share Blob Storage Dataset to be created.

  • containerName - (Required) The name of the storage account container to be shared with the receiver. Changing this forces a new Data Share Blob Storage Dataset to be created.

  • storageAccount - (Required) A storageAccount block as defined below. Changing this forces a new resource to be created.

  • filePath - (Optional) The path of the file in the storage container to be shared with the receiver. Changing this forces a new Data Share Blob Storage Dataset to be created.

  • folderPath - (Optional) The path of the folder in the storage container to be shared with the receiver. Changing this forces a new Data Share Blob Storage Dataset to be created.


A storageAccount block supports the following:

  • name - (Required) The name of the storage account to be shared with the receiver. Changing this forces a new Data Share Blob Storage Dataset to be created.

  • resourceGroupName - (Required) The resource group name of the storage account to be shared with the receiver. Changing this forces a new Data Share Blob Storage Dataset to be created.

  • subscriptionId - (Required) The subscription id of the storage account to be shared with the receiver. Changing this forces a new Data Share Blob Storage Dataset to be created.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Data Share Blob Storage Dataset.

  • displayName - The name of the Data Share Dataset.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Data Share Blob Storage Dataset.
  • read - (Defaults to 5 minutes) Used when retrieving the Data Share Blob Storage Dataset.
  • delete - (Defaults to 30 minutes) Used when deleting the Data Share Blob Storage Dataset.

Import

Data Share Blob Storage Datasets can be imported using the resourceId, e.g.

terraform import azurerm_data_share_dataset_blob_storage.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataShare/accounts/account1/shares/share1/dataSets/dataSet1