gcloud alpha resource-config bulk-export - export configurations for all assets within the specified project, organization, or folder
gcloud alpha resource-config bulk-export [--on-error=ON_ERROR; default="ignore"] [--path=PATH; default="-"] [--resource-format=RESOURCE_FORMAT] [--folder=FOLDER | --organization=ORGANIZATION | --project=PROJECT] [--storage-path=STORAGE_PATH | --resource-types=[RESOURCE_TYPE,...] | --resource-types-file=RESOURCE_TYPE_FILE] [GCLOUD_WIDE_FLAG ...]
(ALPHA) Export configurations for all assets within the specified project, organization, or folder.
To export all resources in a project to a local directory, run:
$ gcloud alpha resource-config bulk-export --path=/path/to/dir/
To export all resources in a organization to stdout, run:
$ gcloud alpha resource-config bulk-export --organization=12345 \ --path=-
To export all resources in a folder to stdout in Terraform format, run:
$ gcloud alpha resource-config bulk-export --folder=12345 \ --resource-format=terraform
To export all resources in a project to stdout, using a custom Google Storage bucket for interim results, run:
$ gcloud alpha resource-config bulk-export --project=my-project \ --storage-path='gs://your-bucket-name/your/prefix/path'
To export all Storage Bucket and Compute Instances resources in project my-project to stdout, run:
$ gcloud alpha resource-config bulk-export --project=my-project \ --resource-types=storage.cnrm.cloud.google.com/StorageBucket,\ ComputeInstance
To export all resource types in file 'types-file.txt' in project my-project to stdout, run:
$ gcloud alpha resource-config bulk-export --project=my-project \ --resource-types-file=types-file.txt
- --on-error=ON_ERROR; default="ignore"
Determines behavior when a recoverable error is encountered while exporting a resource. To stop execution when encountering an error, specify "halt". To log errors when encountered and continue the export, specify "continue". To continue when errors are encountered without logging, specify "ignore". ON_ERROR must be one of: continue, halt, ignore.
- --path=PATH; default="-"
Path of the directory or file to output configuration(s). To output configurations to stdout, specify "--path=-".
- --resource-format=RESOURCE_FORMAT
Format of the configuration to export. Available configuration formats are Kubernetes Resource Model YAML (krm) or Terraform HCL (terraform). Command defaults to "krm". RESOURCE_FORMAT must be one of: krm, terraform.
- RESOURCE PARENT FLAG - specify one of the following to determine the
scope of exported resources.
At most one of these can be specified:
- --folder=FOLDER
Folder ID
- --organization=ORGANIZATION
Organization ID
- --project=PROJECT
Project ID
- Select storage-path if you want to specify the Google Cloud Storage
bucket bulk-export should use for Cloud Asset Inventory Export. Alternatively, you can provide a RESOURCE TYPE FILTER to filter resources. Filtering resources does not use Google Cloud Storage to export resources.
At most one of these can be specified:
- --storage-path=STORAGE_PATH
Google Cloud Storage path where a Cloud Asset Inventory export will be stored, example: gs://your-bucket-name/your/prefix/path
- RESOURCE TYPE FILTERS - specify resource types to export.
At most one of these can be specified:
- --resource-types=[RESOURCE_TYPE,...]
List of Config Connector KRM Kinds to export. For a full list of supported resource types for a given parent scope run:
$ gcloud alpha resource-config list-resource-types \ --[project|organization|folder]=<PARENT>
- --resource-types-file=RESOURCE_TYPE_FILE
A comma (',') or newline ('\n') separated file containing the list of Config Connector KRM Kinds to export. For a full list of supported resource types for a given parent scope run:
$ gcloud alpha resource-config list-resource-types \ --[project|organization|folder]=<PARENT>
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist. This variant is also available:
$ gcloud beta resource-config bulk-export