Same thing happened to my old A5. Your ballast is likely dying, you’ll likely need to replace that and the bulb. You don’t need a whole new headlight.
Pros: replace ballast and bulb
Cons: ballast likely dying
Vehicle:
Audi A5