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.
Con la integración de Secret Manager de Cloud Code, puedes crear, ver, actualizar y usar secretos dentro de tu IDE y sin tenerlos en tu base de código.
En esta página, se describe cómo acceder a Secret Manager dentro de tu IDE y cómo comenzar a crear y administrar secretos.
Habilita Secret Manager
Cuando se administran secretos con Cloud Code, estos se almacenan de forma segura en Secret Manager y se pueden recuperar de manera programática cuando los necesites. Todo lo que necesitas es la API de Secret Manager habilitada y los permisos adecuados para administrar secretos:
Para iniciar el Secret Manager, haz clic en la pestaña Secret Manager en la barra lateral derecha de Cloud Code.
Si no has habilitado la API de Secret Manager, Cloud Code te pedirá que la habilites dentro del panel de Secret Manager; para ello, haz clic en Habilitar API.
Tu secreto también debe estar en el mismo proyecto que el código de tu aplicación. Asegúrate de tener seleccionado el proyecto correcto o de cambiar con el selector de proyectos en el panel de Secret Manager.
Crea y visualiza secretos
Crea secretos
Puedes crear un secreto con uno de los siguientes métodos:
Usa el panel de Secret Manager
Navega al panel de Secret Manager.
Haz clic en el ícono “Agregar”.
Esto inicia el cuadro de diálogo Crear secreto en el que puedes configurar el proyecto, el nombre y el valor de tu secreto, y también elegir una región para almacenar tus secretos y etiquetas y así organizarlos.
Usa el editor
Abre un archivo que contenga el texto que desees almacenar como un secreto en el editor.
Resalta el texto y haz clic con el botón derecho.
En el menú, selecciona el elemento del menú Create Secret in Secret Manager....
Esto abrirá el cuadro de diálogo Crear secreto con el valor secreto completado con el texto destacado. Puedes personalizar el proyecto, el nombre, el valor, la región y las etiquetas del secreto aquí.
Usa el explorador de proyectos
En el explorador de proyectos, sin destacar el texto, haz clic con el botón derecho.
En el menú, selecciona el elemento del menú Create Secret in Secret Manager....
Se abrirá el cuadro de diálogo Crear secreto. Elige el proyecto, el nombre, el valor, la región y las etiquetas del secreto, y haz clic en Aceptar cuando termines.
Crea versiones nuevas de secretos
Si tienes un secreto existente y deseas actualizarlo, puedes navegar a la pestaña Versiones del panel del administrador de Secret Manager:
Haz clic en el ícono Agregar dentro de la pestaña Versiones.
Se abrirá un cuadro de diálogo Agregar versión nueva en el que podrás establecer el valor del secreto existente mediante el campo Valor del secreto o mediante la importación de un archivo.
Si prefieres quitar todas las versiones anteriores del secreto y conservar solo la versión nueva, selecciona Disable all past versions.
Una vez que hagas clic en Aceptar y se agregue la versión, podrás 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.
También puedes hacer clic con el botón derecho en el secreto y elegir Abrir en la consola de Cloud para ver y administrar el secreto en tu navegador.
Cómo ver versiones de secretos
Para ver las versiones de un secreto, selecciona uno de la lista que se muestra en la sección Nombre del secreto y, luego, selecciona la pestaña Versiones.
Haz clic con el botón derecho en la versión del secreto sobre la que deseas tomar medidas y elige entre las opciones disponibles: ver el valor del secreto, copiar el ID de la versión, habilitar o inhabilitar la versión y destruir la versión seleccionada
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:
Instala la biblioteca cliente del administrador de Secret Manager.
Navega a Herramientas > Cloud Code > Agregar bibliotecas de Cloud y administrar las API de Cloud y selecciona Secret Manager > API del administrador de secretos del árbol del Explorador de API de Google Cloud. Sigue las instrucciones específicas del lenguaje que se indican en la sección Instala la biblioteca cliente.
Por último, para completar la configuración de autenticación, debes seguir la guía de autenticación de las bibliotecas cliente:
Desarrollo local: Si desarrollas en un clúster local (como Minikube, Docker Desktop) o un emulador local, debes completar los pasos que se ilustran en la sección de desarrollo local relevante para el flujo de trabajo.
Desarrollo remoto: Si usas un clúster de GKE o un servicio de Cloud Run en tu aplicación, debes completar los pasos que se ilustran en la Sección de desarrollo remoto relevante para tu flujo de trabajo, incluidas las instrucciones específicas de Secret Manager a fin de configurar las funciones necesarias en tu cuenta de servicio.
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-04 (UTC)"],[[["\u003cp\u003eCloud Code's Secret Manager integration allows you to manage secrets directly within your IDE without storing them in your codebase.\u003c/p\u003e\n"],["\u003cp\u003eYou can create secrets using the Secret Manager panel, the editor, or the project explorer, specifying project, name, value, region, and labels.\u003c/p\u003e\n"],["\u003cp\u003eExisting secrets can be updated by creating new versions in the Versions tab, where you can choose to disable all previous versions.\u003c/p\u003e\n"],["\u003cp\u003eSecrets and their versions can be viewed within the Secret Manager panel, with options to view details, open in the Cloud console, or take actions on specific versions.\u003c/p\u003e\n"],["\u003cp\u003eTo access secrets in your application, install the Secret Manager client library and follow the appropriate authentication setup for local or remote development.\u003c/p\u003e\n"]]],[],null,["# Manage secrets with Secret Manager in Cloud Code for IntelliJ\n\nWith Cloud Code's Secret Manager integration, you\ncan create, view, update, and use secrets within your IDE and without having\nthem in your codebase.\n\nThis page describes how to access Secret Manager within your IDE and how\nyou can get started creating and managing secrets.\n\nEnabling Secret Manager\n-----------------------\n\nWhen managing secrets with Cloud Code, secrets are securely stored\nin Secret Manager and can be programmatically fetched when you need\nthem. All you need is the Secret Manager API enabled and the right\npermissions to manage secrets:\n\n1. To launch Secret Manager, click on the Secret Manager tab in the\n right Cloud Code sidebar.\n\n2. If you haven't enabled the Secret Manager API, Cloud Code prompts\n you to enable it within the Secret Manager panel by clicking **Enable API**.\n\n Your secret also needs to be in the same project as your application code; ensure\n you have the right project selected or switch using the project selector in the\n Secret Manager panel.\n\nCreating and viewing secrets\n----------------------------\n\n### Creating secrets\n\nYou can create a secret with one of the following methods:\n\n#### Using the Secret Manager panel\n\n1. Navigate to the Secret Manager panel.\n\n2. Click the **Add** icon.\n\n This launches a Create Secret dialog where you can set your secret's project,\n name, and value, as well as choose a region to store your secret and labels to\n organize your secrets.\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 and right-click this text.\n\n From the menu, select the `Create Secret in Secret Manager...` menu item.\n This opens the Create Secret dialog with the secret value filled in with\n the highlighted text. You can customize the secret's project,\n name, value, region, and labels here.\n\n#### Using the project explorer\n\n1. In the project explorer, without highlighting any text, right-click.\n2. From the menu, select the `Create Secret in Secret Manager...` menu item. This opens the Create Secret dialog. Choose your secret's project, name, value, region, and labels here, and click **OK** when done.\n\n### Creating new versions of secrets\n\nIf you have an existing secret and would like to update it, you can do so by\nnavigating to the **Versions** tab of the Secret Manager panel:\n\n1. Click the **Add** icon within the **Versions** tab.\n\n This launches a Add new version dialog where you can set the value of your\n existing secret either using the Secret value field or by importing a file.\n\n2. If you'd prefer to remove all previous versions of your secret and keep just\n the new version being created, choose **Disable all past versions**.\n\n3. Once you click **OK** and your version is added, you can see your latest secret\n version, and if applicable, all the versions of your secret listed under\n the **Versions** tab.\n\n### Viewing secrets\n\nTo view secrets, within the Secret Manager panel, select a secret from the list\ndisplayed in the Secret Name section. Its details such as name, replication\npolicy, creation timestamp, and resource ID are listed in the **Overview** tab.\n\nYou can also right-click the secret and choose **Open in Cloud console** to view and\nmanage the secret in your browser.\n\n### Viewing secret versions\n\nTo view versions of a secret, select a secret from the list displayed in the\nSecret Name section and select the **Versions** tab.\n\nRight-click the secret version you'd like to take action on and choose from\nthe available options; viewing the secret value, copying the version ID,\nenabling or disabling the version, and destroying the selected version.\n\nAccessing secrets from your application\n---------------------------------------\n\nOnce 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. Install the Secret Manager client library.\n\n Navigate to **Tools** \\\u003e **Cloud Code** \\\u003e **Add Cloud Libraries and Manage\n Cloud APIs** and select **Secret Manager** \\\u003e **Secret Manager API** from the\n Google Cloud APIs explorer tree. Follow the language-specific instructions\n laid out in the Install Client Library section.\n2. Customize and include the [relevant code snippet](/secret-manager/docs/access-secret-version)\n in your application's code.\n\n3. Finally, to complete your authentication setup, you need to follow the\n Client libraries authentication guide:\n\n - **Local development** : If you're developing on a local cluster (like minikube, Docker Desktop) or a local emulator, you should complete the steps illustrated in the [Local development section](/code/docs/intellij/client-libraries#local_development) relevant to your workflow.\n - **Remote development** : If you're using a GKE cluster or a Cloud Run service in your application, you should complete the steps illustrated in the [Remote development section](/code/docs/intellij/client-libraries#remote_development) relevant to your workflow, including the Secret Manager-specific instructions for setting up the required roles on your service account.\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)."]]