In a medium saucepan, whisk together the all-purpose flour and whole milk over medium heat. Continue to whisk until the mixture thickens and starts to bubble, about 5-7 minutes. Remove from heat and let cool completely.
In a mixing bowl, beat the softened unsalted butter and granulated sugar together using an electric mixer on medium speed until light and fluffy, about 3-5 minutes.
Once the roux has cooled, add it to the butter and sugar mixture. Beat on medium speed until well combined and smooth.
Sift the unsweetened cocoa powder into the frosting mixture along with the vanilla extract. Beat until fully incorporated and the frosting is fluffy and creamy.
If the frosting is too thick, add a tablespoon of milk at a time until it reaches the desired consistency. If it’s too thin, add more cocoa powder or let it sit for a few minutes to thicken.