Skip to content

azurermDataShare

Manages a Data Share.

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";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
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 azurermDataShareAccountExample =
  new azurerm.dataShareAccount.DataShareAccount(this, "example_2", {
    identity: [
      {
        type: "SystemAssigned",
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "example-dsa",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      foo: "bar",
    },
  });
/*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 azurermDataShareExample = new azurerm.dataShare.DataShare(
  this,
  "example_3",
  {
    account_id: azurermDataShareAccountExample.id,
    description: "example desc",
    kind: "CopyBased",
    name: "example_dss",
    snapshot_schedule: [
      {
        name: "example-ss",
        recurrence: "Day",
        start_time: "2020-04-17T04:47:52.9614956Z",
      },
    ],
    terms: "example terms",
  }
);
/*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");

Arguments Reference

The following arguments are supported:

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

  • accountId - (Required) The ID of the Data Share account in which the Data Share is created. Changing this forces a new Data Share to be created.

  • kind - (Required) The kind of the Data Share. Possible values are copyBased and inPlace. Changing this forces a new Data Share to be created.

  • description - (Optional) The Data Share's description.

  • snapshotSchedule - (Optional) A snapshotSchedule block as defined below.

  • terms - (Optional) The terms of the Data Share.


A snapshotSchedule block supports the following:

  • name - (Required) The name of the snapshot schedule.

  • recurrence - (Required) The interval of the synchronization with the source data. Possible values are hour and day.

  • startTime - (Required) The synchronization with the source data's start time.

Attributes Reference

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

  • id - The ID of the Data Share.

Timeouts

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

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

Import

Data Shares can be imported using the resourceId, e.g.

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