I like to sculpt whatever I'm going to use out of Great Stuff foam. Then cover it in 100% silicone and press whatever you want into that to give it a texture; I like cocofiber or bark (be sure to bake any stuff you collect from out in the woods though). Then I use the silicone to glue it to the side of the tank.

Other options are zoo-med magnets. They're made so you can put one on the inside and one on the outside, and attach the shelf to them. I prefer 'gluing' my structures in because as much as my snake climbs on his, I've never had any problems with it falling off. Only problem is that if you need to remove it, you gotta use a putty knife..