Migrate to Terraform
Automatically generate Terraform code from your existing AWS and GCP infrastructure
Overview
Infra.new's cloud resource import feature helps you bring your existing cloud infrastructure under Terraform management. Whether you've been managing resources manually through the console or using other tools, our AI-powered import process automatically generates clean, maintainable Terraform code for your existing resources.
This feature supports both AWS and Google Cloud Platform resources, allowing you to:
- Discover all resources in your cloud accounts
- Select specific resources to import
- Generate production-ready Terraform configurations
- Configure state backend management
- Provide context to guide the AI's code generation
How It Works
Infra.new uses read-only credentials to find resources in your cloud accounts and generate Terraform code for them.
Select Cloud Provider
Choose between AWS or Google Cloud Platform to begin the import process.
Configure Credentials
Select existing credentials or create new ones with appropriate permissions to read your cloud resources.
Discover & Select Resources
Infra.new scans your account and presents all resources. Select which ones to import into Terraform.
Configure State Backend
Choose where to store your Terraform state - S3, GCS, or locally for testing.
Generate Terraform Code
Provide additional context to guide the AI, then generate production-ready Terraform configurations.
Note: The import process is read-only and will not modify any existing resources. It only generates Terraform code that represents your current infrastructure state.
Setup Instructions
Select your cloud provider then follow the steps to import your cloud resources into Terraform:
Before you can import AWS resources, you need to configure AWS credentials with the appropriate permissions.
Configure AWS Credentials
Follow our step-by-step guide to create and configure IAM credentials
Step 1: Enable AWS Resource Explorer
AWS Resource Explorer must be enabled to discover resources in your account:
- Navigate to AWS Resource Explorer in the console
- Click Turn on Resource Explorer
- Select Quick setup
- Choose an aggregator region (typically us-east-1)
- Click Turn on
Note: Initial indexing takes 15-30 minutes to complete.
Step 2: Add Credentials to Infra.new
Once you have your cloud credentials, add them to Infra.new to start the import process:
- Navigate to Credentials in the Infra.new dashboard
- Click Import Cloud Resources
- Select your cloud provider (AWS or GCP)
- Choose to either:
- Use existing credentials if you've already added them
- Add new credentials using the access keys or JSON file from Step 1
Step 3: Discover and Select Resources
After adding credentials, Infra.new will scan your cloud account and display all discovered resources:
Resource Discovery
- The discovery process typically takes 30-60 seconds depending on the number of resources
- Resources are organized by service type (e.g., EC2, S3, RDS for AWS)
- Each resource shows key information like name, type, region, and current state
Selecting Resources to Import
- Use the checkbox next to each resource to select it for import
- Use the service-level checkboxes to select all resources of a type
- The search bar helps you find specific resources by name or ID
- Filter by region, service type, or resource state
Best Practices for Resource Selection
- Start with a small set of related resources for your first import
- Group resources by application or environment
- Consider dependencies between resources (they'll be handled automatically)
- Review the resource count before proceeding - large imports may take longer to generate
Step 4: Configure State Backend
Choose where to store your Terraform state file. This is crucial for managing your infrastructure going forward:
Remote State Backends
For production use, we strongly recommend using a remote backend:
S3 Backend
- • Ideal for AWS-based infrastructure
- • Supports state locking with DynamoDB
- • Can create a new bucket or use existing
GCS Backend
- • Best for GCP infrastructure
- • Built-in state locking
- • Can create a new bucket or use existing
When configuring a remote backend, you'll specify the bucket name, prefix/key for organizing state files, and the region where the bucket is located.
Local State Backend
For testing or development purposes, you can use local state storage:
- State is stored on your local machine
- No remote infrastructure required
- Not recommended for team environments or production
⚠️ Local state files are not shared between team members and can be accidentally deleted
Step 5: Review and Generate Code
The final step allows you to review your selections and provide context to guide the AI code generation:
Summary Review
Before generating code, you'll see a summary of:
- Total number of resources selected for import
- Resources grouped by service type
- Selected state backend configuration
- Any detected dependencies between resources
Provide Additional Context
To generate optimal Terraform code, you can provide additional context about your infrastructure:
Example context you might provide:
- "This is a production environment for our e-commerce application"
- "Organize resources into modules by service type"
- "Include variables for environment-specific configuration"
- "Add comments explaining the purpose of each resource"
- "Use naming conventions that follow our company standards"
Code Generation
Once you click Generate Terraform Code, Infra.new will:
- Analyze all selected resources and their configurations
- Detect relationships and dependencies
- Generate clean, modular Terraform code
- Include the import blocks needed to adopt existing resources
- Configure the specified state backend
- Apply any context or preferences you provided
After Generation
Once your Terraform code is generated, you can:
- Review and edit the generated code directly in Infra.new
- Run
terraform plan
to verify the import - Apply the configuration to complete the import process
- Continue managing your infrastructure as code
- Track changes to your infrastructure over time
Supported Resources
Infra.new supports importing most commonly used cloud resources. Here's a partial list by provider:
AWS Resources
Compute
EC2 Instances, Lambda Functions, ECS Services, EKS Clusters
Storage
S3 Buckets, EBS Volumes, EFS File Systems
Database
RDS Instances, DynamoDB Tables, ElastiCache Clusters
Networking
VPCs, Subnets, Security Groups, Load Balancers
IAM
Roles, Policies, Users, Groups
GCP Resources
Compute
Compute Instances, Cloud Run Services, GKE Clusters
Storage
Cloud Storage Buckets, Persistent Disks
Database
Cloud SQL Instances, Firestore, Bigtable
Networking
VPC Networks, Subnets, Firewalls, Load Balancers
IAM
Service Accounts, IAM Policies, Custom Roles
This is not an exhaustive list. Infra.new continuously adds support for more resource types. If you encounter an unsupported resource, it will be flagged during the discovery process.
Limitations and Considerations
- State File Size: Very large infrastructures may result in large state files. Consider importing resources in logical groups.
- Sensitive Data: Some resources may contain sensitive data in their configuration. Review generated code and use variables for sensitive values.
- Resource Dependencies: Complex dependency chains are automatically detected, but manual review is recommended for critical resources.
- Naming Conflicts: Imported resource names are sanitized to be Terraform-compliant. You may want to refactor names after import.
- Default Resources: Some default or system-managed resources are filtered out during discovery as they shouldn't be managed by Terraform.
Next Steps
After successfully importing your cloud resources:
After Generation
After Generation
Once your Terraform code is generated, you can:
- Review and edit the generated code directly in Infra.new
- Run
terraform plan
to verify the import - Apply the configuration to complete the import process
- Continue managing your infrastructure as code
- Track changes to your infrastructure over time
Supported Resources
Infra.new supports importing most commonly used cloud resources. Here's a partial list by provider:
AWS Resources
Compute
EC2 Instances, Lambda Functions, ECS Services, EKS Clusters
Storage
S3 Buckets, EBS Volumes, EFS File Systems
Database
RDS Instances, DynamoDB Tables, ElastiCache Clusters
Networking
VPCs, Subnets, Security Groups, Load Balancers
IAM
Roles, Policies, Users, Groups
GCP Resources
Compute
Compute Instances, Cloud Run Services, GKE Clusters
Storage
Cloud Storage Buckets, Persistent Disks
Database
Cloud SQL Instances, Firestore, Bigtable
Networking
VPC Networks, Subnets, Firewalls, Load Balancers
IAM
Service Accounts, IAM Policies, Custom Roles
This is not an exhaustive list. Infra.new continuously adds support for more resource types. If you encounter an unsupported resource, it will be flagged during the discovery process.
Limitations and Considerations
- State File Size: Very large infrastructures may result in large state files. Consider importing resources in logical groups.
- Sensitive Data: Some resources may contain sensitive data in their configuration. Review generated code and use variables for sensitive values.
- Resource Dependencies: Complex dependency chains are automatically detected, but manual review is recommended for critical resources.
- Naming Conflicts: Imported resource names are sanitized to be Terraform-compliant. You may want to refactor names after import.
- Default Resources: Some default or system-managed resources are filtered out during discovery as they shouldn't be managed by Terraform.
Next Steps
After successfully importing your cloud resources:
Migrate to Terraform
Automatically generate Terraform code from your existing AWS and GCP infrastructure
Overview
Infra.new's cloud resource import feature helps you bring your existing cloud infrastructure under Terraform management. Whether you've been managing resources manually through the console or using other tools, our AI-powered import process automatically generates clean, maintainable Terraform code for your existing resources.
This feature supports both AWS and Google Cloud Platform resources, allowing you to:
- Discover all resources in your cloud accounts
- Select specific resources to import
- Generate production-ready Terraform configurations
- Configure state backend management
- Provide context to guide the AI's code generation
How It Works
Infra.new uses read-only credentials to find resources in your cloud accounts and generate Terraform code for them.
Select Cloud Provider
Choose between AWS or Google Cloud Platform to begin the import process.
Configure Credentials
Select existing credentials or create new ones with appropriate permissions to read your cloud resources.
Discover & Select Resources
Infra.new scans your account and presents all resources. Select which ones to import into Terraform.
Configure State Backend
Choose where to store your Terraform state - S3, GCS, or locally for testing.
Generate Terraform Code
Provide additional context to guide the AI, then generate production-ready Terraform configurations.
Note: The import process is read-only and will not modify any existing resources. It only generates Terraform code that represents your current infrastructure state.
Setup Instructions
Select your cloud provider then follow the steps to import your cloud resources into Terraform:
Before you can import AWS resources, you need to configure AWS credentials with the appropriate permissions.
Configure AWS Credentials
Follow our step-by-step guide to create and configure IAM credentials
Step 1: Enable AWS Resource Explorer
AWS Resource Explorer must be enabled to discover resources in your account:
- Navigate to AWS Resource Explorer in the console
- Click Turn on Resource Explorer
- Select Quick setup
- Choose an aggregator region (typically us-east-1)
- Click Turn on
Note: Initial indexing takes 15-30 minutes to complete.
Step 2: Add Credentials to Infra.new
Once you have your cloud credentials, add them to Infra.new to start the import process:
- Navigate to Credentials in the Infra.new dashboard
- Click Import Cloud Resources
- Select your cloud provider (AWS or GCP)
- Choose to either:
- Use existing credentials if you've already added them
- Add new credentials using the access keys or JSON file from Step 1
Step 3: Discover and Select Resources
After adding credentials, Infra.new will scan your cloud account and display all discovered resources:
Resource Discovery
- The discovery process typically takes 30-60 seconds depending on the number of resources
- Resources are organized by service type (e.g., EC2, S3, RDS for AWS)
- Each resource shows key information like name, type, region, and current state
Selecting Resources to Import
- Use the checkbox next to each resource to select it for import
- Use the service-level checkboxes to select all resources of a type
- The search bar helps you find specific resources by name or ID
- Filter by region, service type, or resource state
Best Practices for Resource Selection
- Start with a small set of related resources for your first import
- Group resources by application or environment
- Consider dependencies between resources (they'll be handled automatically)
- Review the resource count before proceeding - large imports may take longer to generate
Step 4: Configure State Backend
Choose where to store your Terraform state file. This is crucial for managing your infrastructure going forward:
Remote State Backends
For production use, we strongly recommend using a remote backend:
S3 Backend
- • Ideal for AWS-based infrastructure
- • Supports state locking with DynamoDB
- • Can create a new bucket or use existing
GCS Backend
- • Best for GCP infrastructure
- • Built-in state locking
- • Can create a new bucket or use existing
When configuring a remote backend, you'll specify the bucket name, prefix/key for organizing state files, and the region where the bucket is located.
Local State Backend
For testing or development purposes, you can use local state storage:
- State is stored on your local machine
- No remote infrastructure required
- Not recommended for team environments or production
⚠️ Local state files are not shared between team members and can be accidentally deleted
Step 5: Review and Generate Code
The final step allows you to review your selections and provide context to guide the AI code generation:
Summary Review
Before generating code, you'll see a summary of:
- Total number of resources selected for import
- Resources grouped by service type
- Selected state backend configuration
- Any detected dependencies between resources
Provide Additional Context
To generate optimal Terraform code, you can provide additional context about your infrastructure:
Example context you might provide:
- "This is a production environment for our e-commerce application"
- "Organize resources into modules by service type"
- "Include variables for environment-specific configuration"
- "Add comments explaining the purpose of each resource"
- "Use naming conventions that follow our company standards"
Code Generation
Once you click Generate Terraform Code, Infra.new will:
- Analyze all selected resources and their configurations
- Detect relationships and dependencies
- Generate clean, modular Terraform code
- Include the import blocks needed to adopt existing resources
- Configure the specified state backend
- Apply any context or preferences you provided
After Generation
Once your Terraform code is generated, you can:
- Review and edit the generated code directly in Infra.new
- Run
terraform plan
to verify the import - Apply the configuration to complete the import process
- Continue managing your infrastructure as code
- Track changes to your infrastructure over time
Supported Resources
Infra.new supports importing most commonly used cloud resources. Here's a partial list by provider:
AWS Resources
Compute
EC2 Instances, Lambda Functions, ECS Services, EKS Clusters
Storage
S3 Buckets, EBS Volumes, EFS File Systems
Database
RDS Instances, DynamoDB Tables, ElastiCache Clusters
Networking
VPCs, Subnets, Security Groups, Load Balancers
IAM
Roles, Policies, Users, Groups
GCP Resources
Compute
Compute Instances, Cloud Run Services, GKE Clusters
Storage
Cloud Storage Buckets, Persistent Disks
Database
Cloud SQL Instances, Firestore, Bigtable
Networking
VPC Networks, Subnets, Firewalls, Load Balancers
IAM
Service Accounts, IAM Policies, Custom Roles
This is not an exhaustive list. Infra.new continuously adds support for more resource types. If you encounter an unsupported resource, it will be flagged during the discovery process.
Limitations and Considerations
- State File Size: Very large infrastructures may result in large state files. Consider importing resources in logical groups.
- Sensitive Data: Some resources may contain sensitive data in their configuration. Review generated code and use variables for sensitive values.
- Resource Dependencies: Complex dependency chains are automatically detected, but manual review is recommended for critical resources.
- Naming Conflicts: Imported resource names are sanitized to be Terraform-compliant. You may want to refactor names after import.
- Default Resources: Some default or system-managed resources are filtered out during discovery as they shouldn't be managed by Terraform.
Next Steps
After successfully importing your cloud resources:
After Generation
After Generation
Once your Terraform code is generated, you can:
- Review and edit the generated code directly in Infra.new
- Run
terraform plan
to verify the import - Apply the configuration to complete the import process
- Continue managing your infrastructure as code
- Track changes to your infrastructure over time
Supported Resources
Infra.new supports importing most commonly used cloud resources. Here's a partial list by provider:
AWS Resources
Compute
EC2 Instances, Lambda Functions, ECS Services, EKS Clusters
Storage
S3 Buckets, EBS Volumes, EFS File Systems
Database
RDS Instances, DynamoDB Tables, ElastiCache Clusters
Networking
VPCs, Subnets, Security Groups, Load Balancers
IAM
Roles, Policies, Users, Groups
GCP Resources
Compute
Compute Instances, Cloud Run Services, GKE Clusters
Storage
Cloud Storage Buckets, Persistent Disks
Database
Cloud SQL Instances, Firestore, Bigtable
Networking
VPC Networks, Subnets, Firewalls, Load Balancers
IAM
Service Accounts, IAM Policies, Custom Roles
This is not an exhaustive list. Infra.new continuously adds support for more resource types. If you encounter an unsupported resource, it will be flagged during the discovery process.
Limitations and Considerations
- State File Size: Very large infrastructures may result in large state files. Consider importing resources in logical groups.
- Sensitive Data: Some resources may contain sensitive data in their configuration. Review generated code and use variables for sensitive values.
- Resource Dependencies: Complex dependency chains are automatically detected, but manual review is recommended for critical resources.
- Naming Conflicts: Imported resource names are sanitized to be Terraform-compliant. You may want to refactor names after import.
- Default Resources: Some default or system-managed resources are filtered out during discovery as they shouldn't be managed by Terraform.
Next Steps
After successfully importing your cloud resources: