Job 5:17:

Behold, happy is the man whom God correcteth: therefore despise not thou the chastening of the Almighty:

See also:

Some of God’s Promises Have Conditions
Notes on Job 5:26