Bug fix for IAM security credentials metadata URL

This pulls in #1908 and fixes failing unit tests. Fixes issue #1907.

@toastdriven please review. Will do a patch release if everything looks good.