gcloud beta resource-config terraform generate-import Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud beta resource-config terraform generate-import - generate Terraform import script for exported resources
- SYNOPSIS
gcloud beta resource-config terraform generate-importINPUT_PATH[--output-dir=OUTPUT_DIR|--output-module-file=OUTPUT_MODULE_FILE--output-script-file=OUTPUT_SCRIPT_FILE][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(BETA)Generate Terraform import script for exported resources.- EXAMPLES
- To generate an import script named
import.shand a module filenamedmodules.tfbased on exported files inmy-dir/,run:gcloudbetaresource-configterraformgenerate-importmy-dir/--output-script-file=import.sh--output-module-file=modules.tfTo generate an import script with the default
terraform_import_YYYYMMDD-HH-MM-SS.cmdandgcloud-export-modules.tfnames on Windows, based on exported filesinmy-dir/, run:gcloudbetaresource-configterraformgenerate-importmy-dir - POSITIONAL ARGUMENTS
INPUT_PATH- Path to a Terrafrom formatted (.tf) resource file or directory of files exportedvia.
gcloud alpharesource-config bulk-exportor resource surface specificconfigexportcommand.
- OUTPUT DESTINATION FLAGS
- Specify the destination of the generated script.
At most one of these can be specified:
--output-dir=OUTPUT_DIR- Specify the output directory only for the generated import script. If specifieddirectory does not exists it will be created. Generated script will have adefault name of the form
terraform_import_YYYYMMDD-HH-MM-SS.sh|cmd - Specify the exact filenames for the output import script and module files.
--output-module-file=OUTPUT_MODULE_FILE- Specify the full path path for generated terraform module file. If not set, adefault filename of
gcloud-export-modules.tfwill be generated. --output-script-file=OUTPUT_SCRIPT_FILE- Specify the full path path for generated import script. If not set, a defaultfilename of the form
terraform_import_YYYYMMDD-HH-MM-SS.sh|cmdwillbe generated.
- Specify the destination of the generated script.
- GCLOUD WIDE FLAGS
- 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 helpfor details. - NOTES
- This command is currently in beta and might change without notice. This variantis also available:
gcloudalpharesource-configterraformgenerate-import
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.