This page describes how to delete a parameter. You must review your parameters periodically to identify those that are no longer necessary. Parameters might become outdated or unnecessary in the following circumstances:
- When they are no longer being used by any application, service, or configuration.
- When they are being used by earlier versions of applications that are no longer in use.
- In the event of a security breach, any potentially compromised parameters should be deleted.
You can only delete parameters that have no active versions (enabled or disabled) associated with it.
Required roles
To get the permissions that you need to delete a parameter,
ask your administrator to grant you the
Parameter Manager Admin (roles/parametermanager.parameterAdmin
) IAM role on the project, folder, or organization.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Delete a parameter
To delete a parameter, use the following command:
gcloud
Delete a global parameter
Before using any of the command data below, make the following replacements:
- PARAMETER_ID: the name of the parameter
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud beta parametermanager parameters delete PARAMETER_ID --location=global
Windows (PowerShell)
gcloud beta parametermanager parameters delete PARAMETER_ID --location=global
Windows (cmd.exe)
gcloud beta parametermanager parameters delete PARAMETER_ID --location=global
You should receive a response similar to the following:
You are about to delete parameter [app_config] Do you want to continue (Y/n)? y Deleted parameter [app_config].
Delete a regional parameter
Before using any of the command data below, make the following replacements:
- PARAMETER_ID: the name of the parameter
- LOCATION: the Google Cloud location of the parameter
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud beta parametermanager parameters delete PARAMETER_ID --location=LOCATION
Windows (PowerShell)
gcloud beta parametermanager parameters delete PARAMETER_ID --location=LOCATION
Windows (cmd.exe)
gcloud beta parametermanager parameters delete PARAMETER_ID --location=LOCATION
You should receive a response similar to the following:
You are about to delete parameter [app_config] Do you want to continue (Y/n)? y Deleted parameter [app_config].
REST
Delete a global parameter
Before using any of the request data, make the following replacements:
- PROJECT_ID: the Google Cloud project ID
- PARAMETER_ID: the name of the parameter
HTTP method and URL:
DELETE https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters/PARAMETER_ID
Request JSON body:
{}
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters/PARAMETER_ID"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters/PARAMETER_ID" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{}
Delete a regional parameter
Before using any of the request data, make the following replacements:
- LOCATION: the Google Cloud location of the parameter
- PROJECT_ID: the Google Cloud project ID
- PARAMETER_ID: the name of the parameter
HTTP method and URL:
DELETE https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters/PARAMETER_ID
Request JSON body:
{}
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters/PARAMETER_ID"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters/PARAMETER_ID" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{}