This page describes how to disable versions within a parameter.
Disabling parameter versions is helpful in the following scenarios:
- If a specific version of a parameter represents a deprecated or outdated configuration, disabling it prevents accidental use.
- If a version contains sensitive information that should no longer be accessible, disabling it mitigates security risks.
- If you suspect that a specific version of a parameter is causing problems, disabling the version can help isolate the issue.
- If you're testing new configurations or experimenting with different settings, you might disable versions temporarily.
Required roles
To get the permissions that you need to disable a parameter version,
ask your administrator to grant you the
Parameter Manager Admin (roles/parametermanager.parameterAdmin
) IAM role on the parameter, 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.
Disable a parameter version
To disable a parameter version, use the following command:
gcloud
Disable a global parameter version
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 beta parametermanager parameters versions update PARAMETER_VERSION_ID --parameter=PARAMETER_ID --location=global --disabled
Windows (PowerShell)
gcloud beta parametermanager parameters versions update PARAMETER_VERSION_ID --parameter=PARAMETER_ID --location=global --disabled
Windows (cmd.exe)
gcloud beta parametermanager parameters versions update PARAMETER_VERSION_ID --parameter=PARAMETER_ID --location=global --disabled
You should receive a response similar to the following:
Updated parameterVersion [range1]. createTime: '2024-11-14T10:07:12.883361876Z' disabled: true name: projects/production-1/locations/global/parameters/allowed_ip_ranges/versions/range1 updateTime: '2024-11-14T10:21:00.238113299Z'
Disable a regional parameter version
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 beta parametermanager parameters versions update PARAMETER_VERSION_ID --parameter=PARAMETER_ID --location=LOCATION --disabled
Windows (PowerShell)
gcloud beta parametermanager parameters versions update PARAMETER_VERSION_ID --parameter=PARAMETER_ID --location=LOCATION --disabled
Windows (cmd.exe)
gcloud beta parametermanager parameters versions update PARAMETER_VERSION_ID --parameter=PARAMETER_ID --location=LOCATION --disabled
You should receive a response similar to the following:
Updated parameterVersion [v1]. createTime: '2024-11-14T10:07:12.883361876Z' disabled: true name: projects/production-1/locations/us-central1/parameters/p1/versions/v1 updateTime: '2024-11-14T10:21:00.238113299Z'
REST
Disable a global parameter version
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:
PATCH https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/parameters/PARAMETER_ID/versions/PARAMETER_VERSION_ID
Request JSON body:
{"disabled": true}
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 PATCH \
-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 PATCH `
-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:
{ "name": "projects/production-1/locations/global/parameters/allowed_ip_ranges/versions/range1", "createTime": "2024-10-15T08:39:05.191747694Z", "updateTime": "2024-10-15T08:39:05.530311092Z", "disabled": true }
Disable a regional parameter version
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:
PATCH https://parametermanager.LOCATION.rep.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/parameters/PARAMETER_ID/versions/PARAMETER_VERSION_ID
Request JSON body:
{"disabled": true}
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 PATCH \
-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 PATCH `
-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:
{ "name": "projects/production-1/locations/us-central1/parameters/p1/versions/v1", "createTime": "2024-11-22T05:24:41.338299211Z", "updateTime": "2024-11-22T05:35:12.630776330Z", "disabled": true }