Skip to content

YAML handle on shell by yq

Overview

Example

ID_TOKEN=$(curl -0 -X POST https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/SERVICE_ACCOUNT:generateIdToken \
  -H "Content-Type: text/json; charset=utf-8" \
  -H "Authorization: Bearer $STS_TOKEN" \
  -d @- <<EOF | jq -r .token
  {
      "audience": "SERVICE_URL"
  }
EOF)
echo $ID_TOKEN

Reference

copy from: https://cloud.google.com/run/docs/authenticating/service-to-service#console-ui