azurermStorageBlobInventoryPolicy
Manages a Storage Blob Inventory Policy.
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 azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
this,
"example_2",
{
account_replication_type: "LRS",
account_tier: "Standard",
blob_properties: [
{
versioning_enabled: true,
},
],
location: azurermResourceGroupExample.location,
name: "examplestoracc",
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: "private",
name: "examplecontainer",
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 azurermStorageBlobInventoryPolicyExample =
new azurerm.storageBlobInventoryPolicy.StorageBlobInventoryPolicy(
this,
"example_4",
{
rules: [
{
format: "Csv",
name: "rule1",
schedule: "Daily",
schema_fields: ["Name", "Last-Modified"],
scope: "Container",
storage_container_name: azurermStorageContainerExample.name,
},
],
storage_account_id: 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.*/
azurermStorageBlobInventoryPolicyExample.overrideLogicalId("example");
Arguments Reference
The following arguments are supported:
-
storageAccountId
- (Required) The ID of the storage account to apply this Blob Inventory Policy to. Changing this forces a new Storage Blob Inventory Policy to be created. -
rules
- (Required) One or morerules
blocks as defined below.
A filter
block supports the following:
blobTypes
- (Required) A set of blob types. Possible values areblockBlob
,appendBlob
, andpageBlob
. The storage account withisHnsEnabled
istrue
doesn't supportpageBlob
.
\~> NOTE: The rules.*SchemaFields
for this rule has to include blobType
so that you can specify the blobTypes
.
includeBlobVersions
- (Optional) Includes blob versions in blob inventory or not? Defaults tofalse
.
\~> NOTE: The rules.*SchemaFields
for this rule has to include isCurrentVersion
and versionId
so that you can specify the includeBlobVersions
.
includeDeleted
- (Optional) Includes deleted blobs in blob inventory or not? Defaults tofalse
.
\~> NOTE: If rules.*Scope
is container
, the rules.*SchemaFields
for this rule must include deleted
, version
, deletedTime
, and remainingRetentionDays
so that you can specify the includeDeleted
. If rules.*Scope
is blob
, the rules.*SchemaFields
must include deleted
and remainingRetentionDays
so that you can specify the includeDeleted
. If rules.*Scope
is blob
and the storage account specified by storageAccountId
has hierarchical namespaces enabled (isHnsEnabled
is true
on the storage account), the rules.*SchemaFields
for this rule must include deleted
, version
, deletedTime
, and remainingRetentionDays
so that you can specify the includeDeleted
.
includeSnapshots
- (Optional) Includes blob snapshots in blob inventory or not? Defaults tofalse
.
\~> NOTE: The rules.*SchemaFields
for this rule has to include snapshot
so that you can specify the includeSnapshots
.
-
prefixMatch
- (Optional) A set of strings for blob prefixes to be matched. Maximum of 10 blob prefixes. -
excludePrefixes
- (Optional) A set of strings for blob prefixes to be excluded. Maximum of 10 blob prefixes.
A rules
block supports the following:
-
name
- (Required) The name which should be used for this Blob Inventory Policy Rule. -
storageContainerName
- (Required) The storage container name to store the blob inventory files for this rule. -
format
- (Required) The format of the inventory files. Possible values arecsv
andparquet
. -
schedule
- (Required) The inventory schedule applied by this rule. Possible values aredaily
andweekly
. -
scope
- (Required) The scope of the inventory for this rule. Possible values areblob
andcontainer
. -
schemaFields
- (Required) A list of fields to be included in the inventory. See the Azure API reference for all the supported fields. -
filter
- (Optional) Afilter
block as defined above. Can only be set when thescope
isblob
.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Storage Blob Inventory Policy.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Storage Blob Inventory Policy.read
- (Defaults to 5 minutes) Used when retrieving the Storage Blob Inventory Policy.update
- (Defaults to 30 minutes) Used when updating the Storage Blob Inventory Policy.delete
- (Defaults to 30 minutes) Used when deleting the Storage Blob Inventory Policy.
Import
Storage Blob Inventory Policies can be imported using the resourceId
, e.g.