Skip to content

gcloud Disable Dependent Services

What

When using gcloud to disable services, you may run in to the below error

Please specify disable_dependent_services=true if you want to proceed with disabling all services.

This is actually a terraform error that the API has returned.

It should really read:

Please specify disableDependentServices:true if you want to proceed with disabling all services.
But that's none of my Business

How

You will need to use gcurl

Setup gcurl

alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'

Get the project numerical ID

gcloud projects list | grep "project-name"

Make a note of the Numerical ID

Disable the service

PROJECT=1234
SERVICE="service.googleapis.com"
gcurl -d '{ "disableDependentServices": true,}' "https://serviceusage.googleapis.com/v1/projects/${PROJECT}/services/${SERVICE}:disable"

Want to make this site better? Open a PR or help fund hosting costs