Organízate con las colecciones
Guarda y clasifica el contenido según tus preferencias.
Exportar e importar recursos a Config Connector
En esta página se describe el comando config-connector export y cómo usarlo para Google Cloud exportar Google Cloud recursos a archivos YAML, que puedes importar posteriormente a Config Connector. Si ya tienes acceso al archivo YAML del recurso, sigue los pasos que se indican en Gestionar y eliminar recursos para obtener el recurso.
Limitaciones
No todos los recursos admiten el comando export. Para obtener una lista de los recursos admitidos, ejecuta config-connector print-resources.
Sustituye NAMESPACE_NAME por el nombre de tu espacio de nombres.
Obtén el nombre de recurso completo del recurso que quieras exportar.
Si no sabes el nombre completo del recurso, puedes encontrarlo con uno de los siguientes métodos:
Sustituye NAMESPACE por el espacio de nombres desde el que Config Connector gestiona los recursos.
Confirma que Config Connector gestiona el recurso ejecutando el siguiente comando:
kubectldescribeRESOURCE_TYPERESOURCE_NAME
Haz los cambios siguientes:
RESOURCE_TYPE: el tipo de recurso, por ejemplo, pubsubtopic.
RESOURCE_NAME: el nombre del recurso. No tiene por qué ser el nombre completo del recurso.
Una vez que Config Connector haya adquirido el recurso, podrás gestionarlo siguiendo los pasos que se indican en el artículo Gestionar y eliminar recursos.
Campos opcionales de la herramienta de CLI config-connector
Al ejecutar el comando config-connector export, puede proporcionar los siguientes campos opcionales:
--output: ruta de salida opcional que inhabilita la salida estándar. Si se trata de un archivo, el resultado contiene toda la salida del comando. Si se trata de un directorio, el directorio contiene un archivo nuevo por cada recurso de la salida.
--iam-format: especifica el tipo de recursos de gestión de identidades y accesos que se incluirán en la exportación. Las opciones son
policy
(opción predeterminada), policymember
o none.
--filter-deleted-iam-members: especifica si se deben excluir los principales de gestión de identidades y accesos eliminados.
Las opciones son true o false. El valor predeterminado es false.
[[["Es fácil de entender","easyToUnderstand","thumb-up"],["Me ofreció una solución al problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Es difícil de entender","hardToUnderstand","thumb-down"],["La información o el código de muestra no son correctos","incorrectInformationOrSampleCode","thumb-down"],["Me faltan las muestras o la información que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-21 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003econfig-connector export\u003c/code\u003e command allows users to export existing Google Cloud resources into Config Connector YAML files, enabling them to be managed within Config Connector.\u003c/p\u003e\n"],["\u003cp\u003eWhen exporting, providing the full resource name to \u003ccode\u003econfig-connector export\u003c/code\u003e generates a YAML manifest that can be imported into Config Connector.\u003c/p\u003e\n"],["\u003cp\u003eIf a resource already exists with the same name, Config Connector will take control of the resource with the provided YAML, unless there are conflicts with immutable fields.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econfig-connector print-resources\u003c/code\u003e command can be used to display a list of resources supported by the \u003ccode\u003econfig-connector\u003c/code\u003e tool, along with their respective resource name formats.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econfig-connector export\u003c/code\u003e command supports command line options including output location, oauth2-token, iam-format type, filter for deleted IAM members, and verbose logging.\u003c/p\u003e\n"]]],[],null,["# Export and import resources to Config Connector\n===============================================\n\n*** ** * ** ***\n\nThis page describes the `config-connector export` command and how to use it to\nexport Google Cloud resources into YAML files,\nwhich you can subsequently import into Config Connector. If you already have access to the resource's YAML file,\nfollow the steps in [Managing and deleting resources](/config-connector/docs/how-to/managing-deleting-resources)\nto acquire the resource instead.\n\nLimitations\n-----------\n\nNot all resources support the `export` command. To get a list of supported\nresources, run `config-connector print-resources`.\n| **Tip:** If a resource is not supported by `export`, but is supported by `bulk-export`, you can try [filtering an Asset Inventory export with `bulk-export`](/config-connector/docs/how-to/import-export/bulk-export#discovering_resources_to_import).\n\nBefore you begin\n----------------\n\n1. [Install the `config-connector` CLI tool](/config-connector/docs/how-to/import-export/overview).\n2. To simplify commands, set your default namespace by running the following command: \n\n ```\n kubectl config set-context --current --namespace NAMESPACE_NAME\n ```\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e with your namespace name.\n3. Get the [full resource name](/iam/docs/full-resource-names) for the resource that you want to export. If you don't know the resource's full name, you might be able to find it with one of the following methods:\n - [Use Cloud Asset Inventory to search for a resource](/asset-inventory/docs/search-resources).\n - Use the `describe` or `list` command for the resource, for example `gcloud pubsub topics describe sample-topic --format \"value(name)\"`.\n - Check the resource's product documentation for a guide on getting the resource ID, for example [Getting a Cloud Key Management Service resource ID](/kms/docs/getting-resource-ids).\n\nExport a resource\n-----------------\n\nYou can use the `config-connector` CLI tool to export an existing resource into a YAML file.\n\nTo export a resource into a YAML file, run the following command: \n\n config-connector export \u003cvar translate=\"no\"\u003eRESOURCE_ID\u003c/var\u003e\n\nReplace \u003cvar translate=\"no\"\u003eRESOURCE_ID\u003c/var\u003e with the full name of the resource that you want to export.\n\nThe command outputs the resource in YAML format that can be used by Config Connector.\nThe output should resemble the following example: \n\n apiVersion: pubsub.cnrm.cloud.google.com/v1beta1\n kind: PubSubTopic\n metadata:\n annotations:\n cnrm.cloud.google.com/project-id: my-example-project\n name: sample-topic\n\nImport a resource into Config Connector\n---------------------------------------\n\nAfter you have the YAML file for the resource that you want Config Connector\nto acquire, complete the following steps:\n\n1. Pass your resource into Config Connector by running the following command:\n\n config-connector export \u003cvar translate=\"no\"\u003eRESOURCE_ID\u003c/var\u003e | kubectl apply -f - --namespace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e with the namespace that Config Connector\n manages resources from.\n2. Confirm that Config Connector is managing the resource by running the\n following command:\n\n kubectl describe \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e \u003cvar translate=\"no\"\u003eRESOURCE_NAME\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e: the resource type, for example `pubsubtopic`.\n - \u003cvar translate=\"no\"\u003eRESOURCE_NAME\u003c/var\u003e: the resource name. This doesn't have to be the full resource name.\n\nAfter Config Connector acquires the resource, you can manage that resource\nby following the steps in [Managing and deleting resources](/config-connector/docs/how-to/managing-deleting-resources).\n\n`config-connector` CLI tool optional fields\n-------------------------------------------\n\nWhen running the `config-connector export` command, you can pass the\nfollowing optional fields: \n\n config-connector export RESOURCE_NAME \\\n --output FILENAME \\\n --oauth2-token TOKEN \\\n --iam-format [policy | policymember | none] \\\n --filter-deleted-iam-members [true | false] \\\n --verbose\n\n- `--output`: An optional output path that disables standard output. When a file, the result contains all the command output; when a directory, the directory contains a new file for each resource in the output.\n- `--oauth2-token`: An [OAUTH2 token](/sdk/gcloud/reference/auth/application-default/print-access-token) as the Google Cloud identity. By default, `config-connector` uses the [Google Cloud CLI default credentials](/sdk/docs/authorizing).\n- `--iam-format`: Specifies the kind of IAM resources output with your export. Options are [`policy`](/config-connector/docs/reference/resource-docs/iam/iampolicy) (default), [`policymember`](/config-connector/docs/reference/resource-docs/iam/iampolicymember), or `none`.\n- `--filter-deleted-iam-members`: Specifies whether to filter out deleted IAM principals. Options are `true` or `false`. The default value is `false`.\n- `--verbose`: Enables verbose logging.\n\nWhat's next\n-----------\n\n- Read about how Config Connector [acquires existing Google Cloud resources](/config-connector/docs/how-to/managing-deleting-resources#acquiring_an_existing_resource).\n- [Learn about the resources that Config Connector supports](/config-connector/docs/reference/overview)."]]