This document describes how to render a parameter template version. When you render a template version, Parameter Manager replaces variables in the template version with values from the chosen parameter version to generate the final configuration.
Limitations
The following limitations apply when you render a parameter template version:
- You can select only one parameter version for the render operation. You can't select multiple parameter versions to render a template version.
- The variables in a parameter version must meet the following requirements:
- A variable must be a key-value pair. For example,
{"environment": "production"} - The value of a variable must not contain an array. For example,
{"tags": ["production", "west-coast", "v2"]} - The value of a variable must not contain a nested key-value pair. For example,
{"database": {"host": "localhost", "port": 5432}}
- A variable must be a key-value pair. For example,
- After the variables are substituted, the system validates the final payload to ensure it's a valid JSON or YAML object. The render operation fails if the output is invalid.
- The final configuration payload can't exceed 1 MiB.
Required roles
To get the permissions that you need to render a parameter template version, ask your administrator to grant you the following IAM roles on the parameter, project, folder, or organization :
-
Access parameter templates:
Parameter Manager Template Accessor (
roles/parametermanager.templateAccessor) -
Access parameters:
Parameter Manager Parameter Accessor (
roles/parametermanager.parameterAccessor)
For more information about granting roles, see Manage access to projects, folders, and organizations.
These predefined roles contain the permissions required to render a parameter template version. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to render a parameter template version:
-
Render a template version:
parametermanager.templateversions.render -
Render a parameter version:
parametermanager.parameterversions.render
You might also be able to get these permissions with custom roles or other predefined roles.
Render a parameter template version
To render a parameter template version, use one of the following methods:
Global parameters
Console
-
In the Google Cloud console, go to the Parameter Manager page.
-
Navigate to the Templates tab to view the list of templates associated with the project.
-
Click the template name. The template details page opens to the Versions tab, which lists all versions of the template.
-
Select the parameter template version that you want to render.
-
Click the Actions menu associated with that version, and then click Render.
-
On the Render template version page, select the parameter and parameter version that you want to use to render the template version.
-
Click Render. A new page is displayed with the payload and the rendered value of the template version.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: the Google Cloud project ID
- TEMPLATE_ID: the name of the parameter template
- TEMPLATE_VERSION_ID: the ID of the parameter template version
- PARAMETER_ID: the name of the parameter
- PARAMETER_VERSION_ID: the ID of the parameter version
HTTP method and URL:
GET https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/templates/TEMPLATE_ID/versions/TEMPLATE_VERSION_ID:render?parameter_version=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 GET \
-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/templates/TEMPLATE_ID/versions/TEMPLATE_VERSION_ID:render?parameter_version=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 GET `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/global/templates/TEMPLATE_ID/versions/TEMPLATE_VERSION_ID:render?parameter_version=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:
{
"templateVersion": "projects/123456789012/locations/global/templates/payment_service_blueprint/versions/tv1",
"payload": {
"data": "YXBwTmFtZTogZm9yZXgtdHJhZGluldmVsOiB7ey5sb2dfbGV2ZWx9fQ=="
},
"renderedPayload": "YXBwTmFtZTogZm9yZXgtdHJhZGluZy1lbmdpbmUKbG9nTG",
"format": "TEMPLATE_FORMAT_YAML",
"parameterVersion": "projects/123456789012/locations/global/parameters/prod-overrides/versions/v1"
}
Regional parameters
Console
-
In the Google Cloud console, go to the Parameter Manager page.
-
Navigate to the Templates tab to view the list of templates associated with the project.
-
Click the template name. The template details page opens to the Versions tab, which lists all versions of the template.
-
Select the parameter template version that you want to render.
-
Click the Actions menu associated with that version, and then click Render.
-
On the Render template version page, select the parameter and parameter version that you want to use to render the template version.
-
Click Render. A new page is displayed with the payload and the rendered value of the template version.
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: the Google Cloud project ID
- LOCATION: the Google Cloud location of the parameter
- TEMPLATE_ID: the name of the parameter template
- TEMPLATE_VERSION_ID: the ID of the parameter template version
- PARAMETER_ID: the name of the parameter
- PARAMETER_VERSION_ID: the ID of the parameter version
HTTP method and URL:
GET https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/templates/TEMPLATE_ID/versions/TEMPLATE_VERSION_ID:render?parameter_version=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 GET \
-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/LOCATION/templates/TEMPLATE_ID/versions/TEMPLATE_VERSION_ID:render?parameter_version=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 GET `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://parametermanager.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/templates/TEMPLATE_ID/versions/TEMPLATE_VERSION_ID:render?parameter_version=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:
{
"templateVersion": "projects/123456789012/locations/us-central1/templates/payment_service_blueprint/versions/tv1",
"payload": {
"data": "YXBwTmFtZTogZm9yZXgtdHJhZGluldmVsOiB7ey5sb2dfbGV2ZWx9fQ=="
},
"renderedPayload": "YXBwTmFtZTogZm9yZXgtdHJhZGluZy1lbmdpbmUKbG9nTG",
"format": "TEMPLATE_FORMAT_YAML",
"parameterVersion": "projects/123456789012/locations/us-central1/parameters/prod-overrides/versions/v1"
}