"It is even possible to be thankful for the valley of the shadow, not because we like it or find anything to enjoy in that fearsome ravine but because we have been told ahead of time that it is not the end of the journey. It is on the way to the Lord's house, and when we get there we'll know it was worth enduring any trouble along the way.
The chances are, however, that while we happen to be in the middle of the trouble it doesn't look like anything but trouble. It doesn't occur to us to compare it with the biblical illustrations, and if someone suggested we do this, we might laugh. "You want me to think spiritually about this? Why, it's got nothing to do with the will of God or the path of righteousness or any of that. It's nothing but bad luck."
The Scriptures have a way of covering all the possibilities. Our bad luck can be transformed if we do one simple thing: "Give thanks in all circumstances; for this is the will of God in Christ Jesus for you." ... The circumstances may not look even remotely like the will of God, but to give thanks in (not necessarily for) them is the will of God. That much we can do." quoted from page 75-76 - God's Guidance