////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
[[GoogleSecretManagerVariableResolver]]
:imagesdir: ../assets/images
:openvar: #{
:closevar: }
:description: This describes the usage of a variable resolver to retrieve secrets from Google Secret Manager

== Functionality

This variable resolver can retrieve secrets from Google Secret Manager.

Here are the options to use:

* Project ID: The project ID to reference.
* Location ID: The location ID (Optional)

The variable expression you can resolve with this plugin type is (as always) in the following format:

`{openvar}name:secret-id:value-key{closevar}`

* name: the name of the variable resolver metadata element to use
* path-key: the ID of the secret to retrieve.
* value-key: the key of the value to retrieve in case the value is JSON.

In case we don't specify a `value-key`, you will give back the complete string of the secret.

== Example

Suppose we have a secret defined in JSON format in Secret Manager:

image:metadata-types/variable-resolver/gcp-secret-manager-server.png

We can define a connection called `google-secret` and retrieve values with expressions:

* `{openvar}google-secret:json-secret:hostname{closevar}` : localhost
* `{openvar}google-secret:json-secret:username{closevar}` : john
* `{openvar}google-secret:json-secret{closevar}` : `{"db":"test","hostname":"localhost","password":"some-password","port":"3306","username":"john"}`

