API Error: Unable to get the upload-url

When I run the shell script provided by terraform here: https://www.terraform.io/docs/cloud/run/api.html I receive an error “Could not resolve host: null”

I can see clearly this is because the script is unable to retrieve the upload-url.

When I run this piece of code:

WORKSPACE_ID=($(curl \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  https://app.terraform.io/api/v2/organizations/$ORG_NAME/workspaces/$WORKSPACE_NAME \
  | jq -r '.data.id'))

It returns with the appropriate WORKSPACE_ID which I verified in terraform cloud. But when I run the next piece of code:

echo '{"data":{"type":"configuration-version"}}' > ./create_config_version.json

UPLOAD_URL=($(curl \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  --request POST \
  --data @create_config_version.json \
  https://app.terraform.io/api/v2/workspaces/$WORKSPACE_ID/configuration-versions \
  | jq -r '.data.attributes."upload-url"'))

I get a null value for UPLOAD_URL and the error is {“errors”:[{“status”:“400”,“title”:“invalid document”}]}

Which makes me think it doesn’t exists but it clearly does when I verify in Terraform Cloud. Anyone else have this issue?