Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI Studio
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Lockbox
  • Getting started
    • All guides
    • Creating secrets
    • Updating a secret
    • Configuring access to a secret
    • Getting information about a secret
    • Deleting a secret
    • Deactivating and activating a secret
    • Secret version management
    • Viewing operations with a secret
  • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Getting information about a secret
  • Getting the contents of a secret
  • Viewing permissions to a secret
  1. Step-by-step guides
  2. Getting information about a secret

Getting information about a secret, its contents, and access rights

Written by
Yandex Cloud
Updated at June 9, 2025
  • Getting information about a secret
  • Getting the contents of a secret
  • Viewing permissions to a secret

You can get detailed information about a secret and secret contents and view access rights to a secret.

Getting information about a secretGetting information about a secret

Management console
CLI
Terraform
API
  1. In the management console, select the folder the secret belongs to.
  2. In the list of services, select Lockbox.
  3. In the left-hand menu, select Secrets.
  4. Click the name of the secret you need.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

  1. View the description of the CLI command to get information about a secret:

    yc lockbox secret get --help
    
  2. Get information about a secret by specifying its name or ID:

    yc lockbox secret get <secret_name>
    

    Result:

    id: e6qi98vtdva1********
    folder_id: b1go79qlt1tp********
    created_at: "2023-11-03T15:28:18.909Z"
    name: test-secret
    kms_key_id: abj765aos682********
    status: ACTIVE
    current_version:
      id: e6q7nvojsgmk********
      secret_id: e6qi98vtdva1********
      created_at: "2023-11-03T15:28:18.909Z"
      status: ACTIVE
      payload_entry_keys:
        - example-key
    

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

To get information about a secret using Terraform:

  1. Add the data and output sections to the Terraform configuration file:

    data "yandex_lockbox_secret" "my_secret" {
      secret_id = "<secret_ID>"
    }
    
    output "current_version" {
      value = data.yandex_lockbox_secret.my_secret.current_version
    }
    

    Where:

    • data "yandex_lockbox_secret": Description of the secret as a data source:
      • secret_id: Secret ID.
    • output "current_version": Output variable that contains information about the current secret version:
      • value: Returned value.

    You can replace current_version with any other parameter to get the information you need. For more information about the yandex_lockbox_secret data source parameters, see the relevant provider documentation.

  2. Create resources:

    1. In the terminal, go to the directory where you edited the configuration file.

    2. Make sure the configuration file is correct using this command:

      terraform validate
      

      If the configuration is correct, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. Terraform will show any errors found in your configuration.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    Terraform will create the required resources and display the output variable values in the terminal. To check the results, run:

    terraform output
    

    Result:

    current_version = tolist([
      {
        "created_at" = "2024-03-27T02:45:05Z"
        "description" = ""
        "destroy_at" = ""
        "id" = "e6qo5a6imnm0********"
        "payload_entry_keys" = tolist([
          "key",
        ])
        "secret_id" = "e6qnva6ntl66********"
        "status" = "ACTIVE"
      },
    ])
    

To get information about a secret, use the get REST API method for the Secret resource or the SecretService/Get gRPC API call.

Getting the contents of a secretGetting the contents of a secret

Management console
CLI
Terraform
API
  1. In the management console, select the folder the secret belongs to.
  2. In the list of services, select Lockbox.
  3. In the left-hand menu, select Secrets.
  4. Click the name of the secret you need.
  5. Under Versions, click the secret version you need.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command to get the contents of a secret:

    yc lockbox payload get --help
    
  2. Get the contents of a secret by specifying its name or ID:

    yc lockbox payload get <secret_name_or_ID>
    

    Result:

    version_id: e6q7nvojsgmk********
    entries:
      - key: example-key
        text_value: example-value
    

    If a file is used as the confidential value, the returned secret content will be Base64 encoded. To decode the file, use the Linux base64 utility:

    base64 --decode <path_to_file> > output.txt
    

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

To get the contents of the secret using Terraform:

  1. Add the data and output sections to the Terraform configuration file:

    data "yandex_lockbox_secret_version" "my_secret_version" {
      secret_id  = "<secret_ID>"
      version_id = "<version_ID>"
    }
    
    output "my_secret_entries" {
      value = data.yandex_lockbox_secret_version.my_secret_version.entries
    }
    

    Where:

    • data "yandex_lockbox_secret_version": Description of the secret as a data source:
      • secret_id: Secret ID.
      • version_id: Secret version ID. This is an optional parameter. Defaults to the current secret version.
    • output "my_secret_entries": Output variable which stores the contents of the secret:
      • value: Returned value.

    For more information about the yandex_lockbox_secret_version data source parameters, see the provider documentation.

  2. Create resources:

    1. In the terminal, go to the directory where you edited the configuration file.

    2. Make sure the configuration file is correct using this command:

      terraform validate
      

      If the configuration is correct, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. Terraform will show any errors found in your configuration.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    Terraform will create the required resources and display the output variable values in the terminal. To check the results, run:

    terraform output
    

    Result:

    my_secret_entries = [
      {
        key        = "example-key"
        text_value = "example-value"
      },
      {
        key        = "example-key"
        text_value = "example-value"
      },
    ]
    

To get the secret contents, use the get REST API method for the Payload resource or the PayloadService/Get gRPC API call.

If a file is used as the confidential value, the returned secret content will be Base64 encoded. To decode the file, use the base64 Python module or other suitable tools.

Viewing permissions to a secretViewing permissions to a secret

Management console
CLI
API
  1. In the management console, select the folder the secret belongs to.
  2. In the list of services, select Lockbox.
  3. In the left-hand menu, select Secrets.
  4. Click the name of the secret you need.
  5. In the left-hand panel, select Access bindings.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command to view access permissions to a secret:

    yc lockbox secret list-access-bindings --help
    
  2. View access permissions to a secret by specifying its name or ID:

    yc lockbox secret list-access-bindings <secret_name_or_ID>
    

    Result:

    +---------+---------------+----------------------+
    | ROLE ID | SUBJECT TYPE  |      SUBJECT ID      | 
    +---------+---------------+----------------------+
    | viewer  | federatedUser | ajej2i98kcjd******** | 
    +---------+---------------+----------------------+
    

To view access permissions to a secret, use the ListAccessBindings REST API method for the Secret resource or the SecretService/ListAccessBindings gRPC API call.

Was the article helpful?

Previous
Configuring access to a secret
Next
Deleting a secret
© 2025 Direct Cursus Technology L.L.C.