diff --git a/azurerm/internal/services/storage/client/client.go b/azurerm/internal/services/storage/client/client.go index 3e00b6f18744..6ce269af66b5 100644 --- a/azurerm/internal/services/storage/client/client.go +++ b/azurerm/internal/services/storage/client/client.go @@ -26,6 +26,7 @@ type Client struct { ManagementPoliciesClient storage.ManagementPoliciesClient BlobServicesClient storage.BlobServicesClient CachesClient *storagecache.CachesClient + SubscriptionId string environment az.Environment storageAdAuth *autorest.Authorizer @@ -55,6 +56,7 @@ func NewClient(options *common.ClientOptions) *Client { ManagementPoliciesClient: managementPoliciesClient, BlobServicesClient: blobServicesClient, CachesClient: &cachesClient, + SubscriptionId: options.SubscriptionId, environment: options.Environment, } diff --git a/azurerm/internal/services/storage/data_source_storage_container.go b/azurerm/internal/services/storage/data_source_storage_container.go index 07009dc623b4..d38e804ec52e 100644 --- a/azurerm/internal/services/storage/data_source_storage_container.go +++ b/azurerm/internal/services/storage/data_source_storage_container.go @@ -46,6 +46,11 @@ func dataSourceArmStorageContainer() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + + "resource_manager_id": { + Type: schema.TypeString, + Computed: true, + }, }, } } @@ -95,5 +100,8 @@ func dataSourceArmStorageContainerRead(d *schema.ResourceData, meta interface{}) d.Set("has_immutability_policy", props.HasImmutabilityPolicy) d.Set("has_legal_hold", props.HasLegalHold) + resourceManagerId := client.GetResourceManagerResourceID(storageClient.SubscriptionId, account.ResourceGroup, id.AccountName, id.ContainerName) + d.Set("resource_manager_id", resourceManagerId) + return nil } diff --git a/website/docs/d/storage_container.html.markdown b/website/docs/d/storage_container.html.markdown index 11a4b656a6fd..9706f8b82807 100644 --- a/website/docs/d/storage_container.html.markdown +++ b/website/docs/d/storage_container.html.markdown @@ -24,15 +24,21 @@ data "azurerm_storage_container" "example" { The following arguments are supported: * `name` - The name of the Container. -* `storage_account_name` - The name of the Storage Account where the Container was created. + +* `storage_account_name` - The name of the Storage Account where the Container exists. ## Attributes Reference * `container_access_type` - The Access Level configured for this Container. + * `has_immutability_policy` - Is there an Immutability Policy configured on this Storage Container? + * `has_legal_hold` - Is there a Legal Hold configured on this Storage Container? + * `metadata` - A mapping of MetaData for this Container. +* `resource_manager_id` - The Resource Manager ID of this Storage Container. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: