You have a number of problems, but range isn't one of them
Looking at the details of the spell, it says nothing about object-to-object transformations
That is correct; it is surprisingly difficult to transform one object into another in 5e, but not impossible. You can, however, transform the sun (assuming it is treated as an object, see below) into a creature, such as a rose per your suggestion. This will also have its own complications (see below).
The real issue was the range of the spell [30 feet]
Actually, that is the least of your concerns. The Spellcasting Rules state
The target of a spell must be within the spell's range...Once a spell is cast, its effects aren't limited by its range, unless the spell's description says otherwise.
In your case, this means that so long as any part of the sun is within 30 feet, you can cast polymorph on that part of the sun, and the effects of the polymorph will potentially transform the rest of the sun beyond your 30 foot range.
I say 'potentially' because rather than range, you are up against two other factors. The first is in the description of the polymorph spell itself, which specifies that the target of the spell must be a nonmagical object. If the sun is to be treated as an object, would it be nonmagical? That is a question for your DM, but in many cosmologies the sun is inherently magical. And if it is not magical, that begs the question of how you are surviving there long enough to cast the spell (and not, say, being vaporized by the heat, having air enough to speak the verbal components of the spell, etc.).
If your DM rules that the sun is not magical, the next question is whether it can be considered an object.
For the purpose of these rules, an object is a discrete, inanimate item like a window, door, sword, book, table, chair, or stone, not a building or a vehicle that is composed of many other objects.
Most DMs would rule that something as large and complicated as the sun would not be a single, discrete object, especially if it was non-magical. See also: 'When is an object made of other objects?', and 'How large a thing can True Polymorph produce?'
Finally, suppose you did manage to turn the entire sun into a rose. In the absence of the non-magical sun, the hapless new rose is now presumably in the frozen void of space and will die nearly-instantly. As soon as it dies (reaches 0hp) the polymorph spell will end, restoring it as a non-magical sun-object, as per the spell description.
So, to sum up, among your problems are:
- Transporting yourself to the sun
- Surviving within 30 feet of the sun long enough to cast the spell
- Being able to produce the verbal component of the spell while in space or in the sun.
- Getting the DM to rule that the entire sun is a single object
- Getting the DM to rule that the sun-object is non-magical
(Not a problem: Affecting the entire object so long as any part of it is within 30 feet)
- Having the sun-object-cum-creature survive in the absence of the sun long enough for anyone to notice before it turns back into the sun