Skip to content

azurermStorageContainer

Manages a Container within an Azure Storage Account.

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.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplestoraccount",
    resource_group_name: azurermResourceGroupExample.name,
    tags: {
      environment: "staging",
    },
  }
);
/*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_2", {
    container_access_type: "private",
    name: "vhds",
    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");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Container which should be created within the Storage Account. Changing this forces a new resource to be created.

  • storageAccountName - (Required) The name of the Storage Account where the Container should be created. Changing this forces a new resource to be created.

  • containerAccessType - (Optional) The Access Level configured for this Container. Possible values are blob, container or private. Defaults to private.

  • metadata - (Optional) A mapping of MetaData for this Container. All metadata keys should be lowercase.

Attributes Reference

The following attributes are exported in addition to the arguments listed above:

  • id - The ID of the Storage Container.

  • hasImmutabilityPolicy - Is there an Immutability Policy configured on this Storage Container?

  • hasLegalHold - Is there a Legal Hold configured on this Storage Container?

  • resourceManagerId - The Resource Manager ID of this Storage Container.

Timeouts

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

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

Import

Storage Containers can be imported using the resourceId, e.g.

terraform import azurerm_storage_container.container1 https://example.blob.core.windows.net/container