This page describes how to delete a parameter version.
Consider deleting a parameter version in the following scenarios:
- The version is obsolete and is no longer needed.
- The version contains sensitive information that needs to be permanently removed.
- You want to simplify the management of parameter versions by deleting old and unused versions.
Required roles
To get the permissions that
you need to delete a parameter version,
ask your administrator to grant you the Parameter Manager Parameter Version Manager
( roles/parametermanager.parameterVersionManager
)
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 version
To delete a parameter version, use one of the following methods:
Global parameters
Console
-
In the Google Cloud console, go to the Secret Manager page.
-
Click Parameter Manager to go to the Parameter Manager page. You'll see the list of parameters for that project.
-
Click the parameter name to access its versions. The parameter details page opens. You can see all the versions belonging to the selected parameter in the Versions tab.
-
Select the parameter version that you want to delete.
-
Click the Actions menu associated with that version, and then click Delete .
-
In the confirmation dialog that appears, enter the parameter ID to confirm, and then click click Delete .
gcloud
Before using any of the command data below, make the following replacements:
- PARAMETER_VERSION_ID : the ID of the parameter version
- PARAMETER_ID : the name of the parameter
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud parametermanager parameters versions delete PARAMETER_VERSION_ID --parameter = PARAMETER_ID --location = global
Windows (PowerShell)
gcloud parametermanager parameters versions delete PARAMETER_VERSION_ID --parameter = PARAMETER_ID --location = global
Windows (cmd.exe)
gcloud parametermanager parameters versions delete PARAMETER_VERSION_ID --parameter = PARAMETER_ID --location = global
You should receive a response similar to the following:
You are about to delete parameterVersion [appconfigv1] Do you want to continue (Y/n)? y Deleted parameterVersion [appconfigv1].
REST
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
- PARAMETER_VERSION_ID : the ID of the parameter version
HTTP method and URL:
DELETE https://parametermanager.googleapis.com/v1/projects/ PROJECT_ID /locations/global/parameters/ PARAMETER_ID /versions/ PARAMETER_VERSION_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 /versions/ PARAMETER_VERSION_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 /versions/ PARAMETER_VERSION_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{}
C#
To run this code, first set up a C# development environment and install the Parameter Manager C# SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Go
To run this code, first set up a Go development environment and install the Parameter Manager Go SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Java
To run this code, first set up a Java development environment and install the Parameter Manager Java SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Node.js
To run this code, first set up a Node.js development environment and install the Parameter Manager Node.js SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
PHP
To run this code, first learn about using PHP on Google Cloud and install the Parameter Manager PHP SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Python
To run this code, first set up a Python development environment and install the Parameter Manager Python SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Ruby
To run this code, first set up a Ruby development environment and install the Parameter Manager Ruby SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Regional parameters
Console
-
In the Google Cloud console, go to the Secret Manager page.
-
Click Parameter Manager to go to the Parameter Manager page. You'll see the list of parameters for that project.
-
Click the parameter name to access its versions. The parameter details page opens. You can see all the versions belonging to the selected parameter in the Versions tab.
-
Select the parameter version that you want to delete.
-
Click the Actions menu associated with that version, and then click Delete .
-
In the confirmation dialog that appears, enter the parameter ID to confirm, and then click click Delete .
gcloud
Before using any of the command data below, make the following replacements:
- PARAMETER_VERSION_ID : the ID of the parameter version
- 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 parametermanager parameters versions delete PARAMETER_VERSION_ID --parameter = PARAMETER_ID --location = LOCATION
Windows (PowerShell)
gcloud parametermanager parameters versions delete PARAMETER_VERSION_ID --parameter = PARAMETER_ID --location = LOCATION
Windows (cmd.exe)
gcloud parametermanager parameters versions delete PARAMETER_VERSION_ID --parameter = PARAMETER_ID --location = LOCATION
You should receive a response similar to the following:
You are about to delete parameterVersion [appconfigv1] Do you want to continue (Y/n)? y Deleted parameterVersion [appconfigv1].
REST
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
- PARAMETER_VERSION_ID : the ID of the parameter version
HTTP method and URL:
DELETE https://parametermanager. LOCATION .rep.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION /parameters/ PARAMETER_ID /versions/ PARAMETER_VERSION_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 /versions/ PARAMETER_VERSION_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 /versions/ PARAMETER_VERSION_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{}
C#
To run this code, first set up a C# development environment and install the Parameter Manager C# SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Go
To run this code, first set up a Go development environment and install the Parameter Manager Go SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Java
To run this code, first set up a Java development environment and install the Parameter Manager Java SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Node.js
To run this code, first set up a Node.js development environment and install the Parameter Manager Node.js SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
PHP
To run this code, first learn about using PHP on Google Cloud and install the Parameter Manager PHP SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Python
To run this code, first set up a Python development environment and install the Parameter Manager Python SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .
Ruby
To run this code, first set up a Ruby development environment and install the Parameter Manager Ruby SDK . On Compute Engine or GKE, you must authenticate with the cloud-platform scope .