We bought a condo 5 miles from the beach in a golf community (my wife golfs, I don't) in 2016. I just couldn't see paying for 3 months down there in rent when we could buy. We rent it out 1 or 2 months out of the year to pay our condo and golf fees.
The value has really gone up since 2016, but our HOA insurance has gone crazy. Plus, they're doing an upgrade on the clubhouse and pools, so that's an extra lump sum fee.
Overall, it was a decent investment and, since we're on the 2nd floor, we don't have to worry about flooding. And 5 miles in, we're still close to the beach. But insurance is really driving up the cost of ownership and it's not going to get any better.