diff --git a/internal/services/storage/storage_share_file_resource.go b/internal/services/storage/storage_share_file_resource.go index 4ea6732b3a37..15790f2daa6a 100644 --- a/internal/services/storage/storage_share_file_resource.go +++ b/internal/services/storage/storage_share_file_resource.go @@ -300,7 +300,17 @@ func resourceStorageShareFileRead(d *pluginsdk.ResourceData, meta interface{}) e } d.Set("content_type", props.ContentType) d.Set("content_encoding", props.ContentEncoding) - d.Set("content_md5", props.ContentMD5) + + // Set the ContentMD5 value to md5 hash in hex + contentMD5 := "" + if props.ContentMD5 != "" { + contentMD5, err = convertBase64ToHexEncoding(props.ContentMD5) + if err != nil { + return fmt.Errorf("converting hex to base64 encoding for content_md5: %v", err) + } + } + d.Set("content_md5", contentMD5) + d.Set("content_disposition", props.ContentDisposition) if props.ContentLength == nil { diff --git a/internal/services/storage/storage_share_file_resource_test.go b/internal/services/storage/storage_share_file_resource_test.go index 9e588ae37e41..1f59973e3219 100644 --- a/internal/services/storage/storage_share_file_resource_test.go +++ b/internal/services/storage/storage_share_file_resource_test.go @@ -349,7 +349,8 @@ resource "azurerm_storage_share_file" "test" { name = "test" storage_share_id = azurerm_storage_share.test.id - source = "%s" + source = "%[2]s" + content_md5 = filemd5(%[2]q) metadata = { hello = "world"