Skip to content

Commit

Permalink
d/storage_container: exposing the resource manager id
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Mar 19, 2020
1 parent a58061b commit aa7d629
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions azurerm/internal/services/storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Client struct {
ManagementPoliciesClient storage.ManagementPoliciesClient
BlobServicesClient storage.BlobServicesClient
CachesClient *storagecache.CachesClient
SubscriptionId string

environment az.Environment
storageAdAuth *autorest.Authorizer
Expand Down Expand Up @@ -55,6 +56,7 @@ func NewClient(options *common.ClientOptions) *Client {
ManagementPoliciesClient: managementPoliciesClient,
BlobServicesClient: blobServicesClient,
CachesClient: &cachesClient,
SubscriptionId: options.SubscriptionId,
environment: options.Environment,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func dataSourceArmStorageContainer() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},

"resource_manager_id": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -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
}
8 changes: 7 additions & 1 deletion website/docs/d/storage_container.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit aa7d629

Please sign in to comment.