Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/resource: fix gs:// fetches in GCE without a service account
When running in GCE, we assumed that we should always perform authenticated GS fetches. However, these can fail if the VM is not associated with a service account, even if the object being fetched is publicly readable: error while reading content from ...: metadata: GCE metadata "instance/service-accounts/default/token?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.read_only" not defined Query the VM's service account scopes first, and if that query fails (presumably because there is no service account), fall back to anonymous access.
- Loading branch information