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
Flag | Description | Required |
---|---|---|
--log-level or -l | Sets the logging level (debug , info , warn , error , panic , fatal ). | No |
--log-type | Sets the logging output format (console , json ). | No |
--tags | Filters resources by specified tags. | No |
--include | Includes only the specified resource types. | No |
--exclude | Excludes specific resource types from import. | No |
--output-dir or -o | Specifies the output directory for Terraform state files (default: current directory). | No |
--auto-import | Automatically imports resources to StackGen (default based on StackgenToken ). | No |
--appstack-id | Specifies the appStack ID for resource management. | No |
--download-iac | Downloads 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:
- Import S3 buckets and EC2 instances from AWS (
us-east-1
). - Log details at debug level.
- 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:
- Import all resources from an Azure Resource Group, except VMs.
- Automatically import resources to StackGen if a
StackgenToken
is present.