Skip to content

Commit

Permalink
Merge pull request #6170 from terraform-providers/f/storage-resource-id
Browse files Browse the repository at this point in the history
storage: exposing the `resource_manager_id` field
  • Loading branch information
tombuildsstuff authored Mar 19, 2020
2 parents abd4b22 + 98a6af4 commit cd88350
Show file tree
Hide file tree
Showing 7 changed files with 38 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, accountName, containerName)
d.Set("resource_manager_id", resourceManagerId)

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

"resource_manager_id": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -227,6 +232,9 @@ func resourceArmStorageContainerRead(d *schema.ResourceData, meta interface{}) e
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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func resourceArmStorageShare() *schema.Resource {
},
},

"resource_manager_id": {
Type: schema.TypeString,
Computed: true,
},

"url": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -227,6 +232,9 @@ func resourceArmStorageShareRead(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("Error flattening `acl`: %+v", err)
}

resourceManagerId := client.GetResourceManagerResourceID(storageClient.SubscriptionId, account.ResourceGroup, id.AccountName, id.ShareName)
d.Set("resource_manager_id", resourceManagerId)

return nil
}

Expand Down
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
2 changes: 2 additions & 0 deletions website/docs/r/storage_container.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ The following attributes are exported in addition to the arguments listed above:

* `has_legal_hold` - Is there a Legal Hold configured on this Storage 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
3 changes: 3 additions & 0 deletions website/docs/r/storage_share.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ A `access_policy` block supports the following:
The following attributes are exported in addition to the arguments listed above:

* `id` - The ID of the File Share.

* `resource_manager_id` - The Resource Manager ID of this File Share.

* `url` - The URL of the File Share

## Timeouts
Expand Down

0 comments on commit cd88350

Please sign in to comment.