Skip to main content
⏳ Estimated read time: 2 min read

Cloud to Code Global Flags

Global flags can be used with cloud2code import commands to customise logging, filtering, and output settings.

Usage

cloud2code import <provider> [options] [global flags]

Available Flags

FlagDescriptionRequired
--log-level or -lSets the logging level (debug, info, warn, error, panic, fatal).No
--log-typeSets the logging output format (console, json).No
--tagsFilters resources by specified tags.No
--includeIncludes only the specified resource types.No
--excludeExcludes specific resource types from import.No
--output-dir
or -o
Specifies the output directory for Terraform state files (default: current directory).No
--auto-importAutomatically imports resources to StackGen (default based on StackgenToken).No
--appstack-idSpecifies the appStack ID for resource management.No
--download-iacDownloads Infrastructure as Code (IaC) files (default based on StackgenToken).No

Examples

Usage

cloud2code import aws --region us-east-1 --include aws_s3_bucket,aws_instance --log-level debug --output-dir ./terraform

The above command will:

  1. Import S3 buckets and EC2 instances from AWS (us-east-1).
  2. Log details at debug level.
  3. Save the Terraform files in the ./terraform directory.

Usage

cloud2code import azure --subscription-id <subscription_id> --resource-group my-rg --exclude azure_vm --auto-import

The above command will:

  1. Import all resources from an Azure Resource Group, except VMs.
  2. Automatically import resources to StackGen if a StackgenToken is present.