Skip to content

Commit

Permalink
Merge pull request #25283 from magodo/blob_ds_test
Browse files Browse the repository at this point in the history
`azurerm_storage_blob` Data Source - Fix a bug that incorrectly parse a storage account resource id instead of blob endpoint
  • Loading branch information
manicminer authored Mar 19, 2024
2 parents 5e1ae68 + 343a99a commit e52d8c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/services/storage/storage_blob_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/client"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
"github.com/tombuildsstuff/giovanni/storage/2023-11-03/blob/accounts"
Expand Down Expand Up @@ -94,7 +95,12 @@ func dataSourceStorageBlobRead(d *pluginsdk.ResourceData, meta interface{}) erro
return fmt.Errorf("building Blobs Client: %v", err)
}

accountId, err := accounts.ParseAccountID(accountName, storageClient.StorageDomainSuffix)
blobEndpoint, err := account.DataPlaneEndpoint(client.EndpointTypeBlob)
if err != nil {
return fmt.Errorf("retrieving the blob data plane endpoint: %v", err)
}

accountId, err := accounts.ParseAccountID(*blobEndpoint, storageClient.StorageDomainSuffix)
if err != nil {
return fmt.Errorf("parsing Account ID: %v", err)
}
Expand Down

0 comments on commit e52d8c2

Please sign in to comment.