Administra secretos con Secret Manager en Cloud Code para IntelliJ
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Secret Manager te permite evitar el almacenamiento de secretos en tu base de código.
En su lugar, los almacenas en Secret Manager y los recuperas de manera programática cuando los necesites. Con la integración de Secret Manager de Cloud Code, puedes crear, ver, actualizar y usar secretos con facilidad.
En esta página, se describe cómo acceder a Secret Manager en tu IDE y cómo comenzar a crear y administrar secretos.
Habilita Secret Manager
Tu secreto debe estar en el mismo proyecto que el código de la aplicación y la API de Secret Manager debe estar habilitada para tu proyecto.
Para iniciar el Secret Manager, haz clic en la pestaña Secret Manager en la barra lateral derecha de Cloud Code o ve a Herramientas > Cloud Code > Secret Manager.
Si no habilitaste la API de Secret Manager, haz clic en Habilitar API para habilitarla cuando Cloud Code te solicite.
Crea y visualiza secretos
Crea secretos
Puedes crear un secreto mediante uno de los siguientes métodos:
Usa el panel de Secret Manager
Navega al panel de Secret Manager.
Haz clic en + Add.
En el cuadro de diálogo Crear secreto, configura tu secreto y, luego, haz clic en Aceptar.
Usa el editor
Abre un archivo que contenga el texto que desees almacenar como un secreto en el editor.
Destaca el texto que deseas almacenar como un secreto, haz clic con el botón derecho en el texto y, luego, en Crear secreto en Secret Manager.
En el cuadro de diálogo Crear secreto, configura tu secreto y, luego, haz clic en Aceptar.
Usa el explorador de proyectos
En el explorador de proyectos, sin destacar ningún texto, haz clic con el botón derecho y, luego, en Crear secreto en Secret Manager.
En el cuadro de diálogo Crear secreto, configura tu secreto y, luego, haz clic en Aceptar.
Crea versiones nuevas de secretos
Para actualizar un secreto existente, crea una versión nueva del secreto:
En el panel de Secret Manager, haz clic con el botón derecho en un secreto y, luego, en Nueva versión.
En el cuadro de diálogo Agregar versión nueva, establece el valor del secreto existente mediante el campo Valor del secreto o mediante la importación de un archivo.
Para quitar todas las versiones anteriores del secreto y mantener solo la versión nueva que creas, selecciona Disable all past versions.
Haga clic en OK. Se agrega tu versión, puedes ver la última versión del secreto y, si corresponde, todas las versiones del secreto que aparecen en la pestaña Versiones.
Visualiza secretos
Para ver los secretos, en el panel Secret Manager, selecciona un secreto de la lista que se muestra en la sección Nombre del secreto. Sus detalles, como el nombre, la política de replicación, la marca de tiempo de creación y el ID del recurso se enumeran en la pestaña Descripción general.
Para ver y administrar un secreto en tu navegador, haz clic con el botón derecho en el secreto y, luego, elige Abrir en la consola de Cloud.
Accede a los secretos desde tu aplicación
Una vez que creaste el secreto, puedes incluirlo en tu código y configurar la autenticación.
Para acceder al secreto que recién se creó desde tu aplicación, sigue estos pasos:
En el panel de Secret Manager, haz clic en el nombre del secreto al que deseas acceder en el código y, luego, en la pestaña Código.
Haz clic en Instala la biblioteca cliente del administrador de Secret Manager.
En la página de la API de Secret Manager, configura el proyecto Google Cloudy habilita la API de Secret Manager si aún no lo hiciste.
Sigue las instrucciones en Instalar biblioteca cliente para el lenguaje que usas.
Si usas una cuenta de servicio, asigna a tu cuenta de servicio de Google la función necesaria para acceder a tu secreto de Secret Manager. A fin de obtener información sobre las funciones de IAM disponibles para Secret Manager, consulta la Guía de control de acceso de Secret Manager.
Para completar la configuración de la autenticación, sigue las instrucciones en Configura la autenticación.
Obtenga asistencia
Para enviar comentarios o informar un problema en tu IDE de IntelliJ, ve a Tools > Cloud Code > Help / About > Submit feedback or report an issue para informar un problema en GitHub.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-05 (UTC)"],[[["\u003cp\u003eSecret Manager allows you to store secrets outside of your codebase, enhancing security by fetching them programmatically when needed.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable Secret Manager and create secrets directly within your IDE through the Secret Manager pane, the editor, or the project explorer.\u003c/p\u003e\n"],["\u003cp\u003eUpdating existing secrets involves creating new versions, with the option to disable all past versions to retain only the latest one.\u003c/p\u003e\n"],["\u003cp\u003eSecrets can be viewed with their details in the Overview tab, or they can be opened in the Cloud console for more in-depth management.\u003c/p\u003e\n"],["\u003cp\u003eAccessing secrets within your application involves installing the Secret Manager client library, integrating code snippets, and configuring authentication.\u003c/p\u003e\n"]]],[],null,["# Manage secrets with Secret Manager in Cloud Code for IntelliJ\n\nSecret Manager lets you avoid storing secrets in your codebase.\nInstead, you store them in Secret Manager and fetch them\nprogrammatically when you need them. With Cloud Code's\nSecret Manager integration, you can easily create, view,\nupdate, and use secrets.\n\nThis page describes how to access Secret Manager in your IDE\nand how you can get started creating and managing secrets.\n\nEnabling Secret Manager\n-----------------------\n\nYour secret needs to be in the same project as your application code and\nSecret Manager API needs to be enabled for your project.\n\n1. To launch Secret Manager, click the\n Secret Manager tab in the right Cloud Code\n sidebar or go to **Tools** \\\u003e **Cloud Code** \\\u003e\n **Secret Manager**.\n\n2. If you haven't enabled the Secret Manager API,\n enable it when Cloud Code prompts you by clicking\n **Enable API**.\n\nCreating and viewing secrets\n----------------------------\n\n### Creating secrets\n\nYou can create a secret using one of the following methods:\n\n#### Using the Secret Manager pane\n\n1. Navigate to the Secret Manager pane.\n\n2. Click **+ Add**.\n\n3. In the Create Secret dialog, configure your secret and then click\n **OK**.\n\n#### Using the editor\n\n1. Open a file containing text you would like to store as a secret in the editor.\n2. Highlight the text to store as a secret, right-click the text, and then click **Create Secret in Secret Manager**.\n3. In the Create Secret dialog, configure your secret and then click **OK**.\n\n#### Using the project explorer\n\n1. In the project explorer, without highlighting any text, right-click and then\n click **Create Secret in Secret Manager**.\n\n2. In the Create Secret dialog, configure your secret and then click\n **OK**.\n\n### Creating new versions of secrets\n\nTo update an existing secret, create a new version of the secret:\n\n1. In the Secret Manager pane, right-click a secret and then\n click **New Version**.\n\n2. In the Add new version dialog, set the value of your existing secret by using\n the Secret value field or by importing a file.\n\n3. To remove all previous versions of your secret and keep just the new version\n you're creating, choose **Disable all past versions**.\n\n4. Click **OK**. Your version is added, you can see your latest secret\n version, and if applicable, all the versions of your secret listed on\n the Versions tab.\n\n### Viewing secrets\n\nTo view secrets, in the Secret Manager pane, select a secret\nfrom the list displayed in the Secret Name section. Its details such as name,\nreplication policy, creation timestamp, and resource ID are listed in the\nOverview tab.\n\nTo view and manage a secret in your browser, right-click the secret and then\nchoose **Open in Cloud console**.\n\nAccessing secrets from your application\n---------------------------------------\n\nAfter your secret is created, you can include it in your code and set up\nauthentication.\n\nTo access your newly created secret from your application, follow these steps:\n\n1. In the Secret Manager pane, click the name of the secret you want to access in code and then click the **Code** tab.\n2. Click **Install the Secret Manager client library**.\n3. On the Secret Manager API page, set the Google Cloud project and enable the Secret Manager API if you haven't already.\n4. Follow the instructions under **Install Client Library** for the language you're using.\n5. Customize and include the [relevant code snippet](/secret-manager/docs/access-secret-version) in your application's code.\n6. If you're using a service account, assign your Google service account the role required to access your Secret Manager secret. For information about IAM roles available for Secret Manager, see the [Secret Manager access control guide](/secret-manager/docs/access-control).\n7. To complete your authentication setup, follow the instructions in [Setting up authentication](/code/docs/intellij/client-libraries-ux#setting_up_authentication).\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]