Skip to Content
Dismiss
Innovation
A platform built for AI

Unified, automated, and ready to turn data into intelligence.

Find Out How
Dismiss
June 16-18, Las Vegas
Pure//Accelerate® 2026

Discover how to unlock the true value of your data. 

Register Now
Dismiss
NVIDIA GTC San Jose 2026
Experience the Everpure difference at GTC

March 16-19 | Booth #935
San Jose McEnery Convention Center

Schedule a Meeting

What Is Terraform Import?

Terraform import is a crucial command in the Terraform toolkit. It allows users to bring existing infrastructure under Terraform management, which is essential for integrating Terraform into existing environments without needing to rebuild infrastructure from scratch.

In this article, we’ll take an in-depth look at Terraform import, its significance, and how to use it effectively to automate and improve the consistency of your infrastructure management.

Understanding Terraform Import

Terraform import allows you to take resources that were created outside of Terraform and bring them under its management. This process involves mapping the existing infrastructure resources to corresponding Terraform configurations. By doing this, Terraform can track the state of these resources, including their attributes and relationships, and manage them alongside resources explicitly defined in your Terraform code.

This process offers various benefits, including:

  • Seamless integration: Terraform import allows you to integrate existing infrastructure into your Terraform workflow without needing to rebuild everything from scratch. This is particularly useful when taking over existing environments or migrating workloads to a new platform. You can import resources gradually, ensuring minimal disruption to ongoing operations.
  • Unified management: Once imported, all infrastructure resources can be managed through Terraform's configuration files. This eliminates the need to switch between separate tools or manual processes for managing different parts of your infrastructure.
  • Consistency: Terraform enforces a declarative approach to infrastructure management. By importing existing resources, you can ensure they’re all defined and managed in a consistent way using Terraform configurations. This improves maintainability, reduces errors, and simplifies infrastructure changes. For example, imagine managing a mix of manually provisioned virtual machines (VMs) and VMs created with Terraform. Importing the existing VMs ensures all VMs are defined consistently, allowing you to leverage Terraform features like version control and automated provisioning for all your VMs.

Getting Started with Terraform Import

Terraform import allows you to bring existing infrastructure under Terraform management without having to recreate resources. This short tutorial will guide you through the process of using Terraform import to manage an existing AWS EC2 instance. By the end of the guide, you'll understand how to import resources into Terraform and manage them effectively.

Prerequisites

Before starting, ensure you have the following:

  1. Terraform installed: Download and install Terraform from the official Terraform website.
  2. AWS CLI installed: Install and configure the AWS CLI with appropriate credentials.
  3. Existing AWS EC2 instance: Have an existing EC2 instance that you want to import into Terraform management.
  4.  

Step 1: Set Up Your Terraform Configuration

First, create a directory for your Terraform project and navigate into it. Then, create a new file named main.tf:

$ mkdir terraform-import-tutorial
 $ cd terraform-import-tutorial
 $ touch main.tf

Step 2: Write the Terraform Configuration

In the main.tf file, define the provider and the resource you plan to import. For this tutorial, we'll use an AWS EC2 instance.

provider "aws" {
 region = "us-west-2"
 }
 resource "aws_instance" "example" {
 # The configuration will be filled in after importing the instance.
 }

Step 3: Initialize Terraform

Before using Terraform, initialize your working directory with the necessary plugins:

$ terraform init

Step 4: Identify the EC2 Instance to Import

Locate the EC2 instance ID that you want to import. You can find this in the AWS Management Console or by using the AWS CLI. For example, let's assume the instance ID is i-1234567890abcdef0.

Step 5: Import the EC2 Instance

Use the terraform import command to import the existing EC2 instance into Terraform. Run the following command in your terminal:

$ terraform import aws_instance.example i-1234567890abcdef0

This command tells Terraform to associate the resource aws_instance.example in your configuration with the existing EC2 instance i-1234567890abcdef0.

Step 6: Verify the Import

After the import, Terraform will update the state file with the information about the imported resource. However, your main.tf file will still be incomplete. To fill in the configuration, use the terraform show command to inspect the imported resource and update main.tf accordingly:

$ terraform show

You will see the imported resource's details. Update main.tf to match the resource's actual configuration. Here's an example of what it might look like:

provider "aws" {
 region = "us-west-2"
 }
 resource "aws_instance" "example" {
 ami           = "ami-0c55b159cbfafe1f0"  # Replace with your instance's AMI ID
 instance_type = "t2.micro"                # Replace with your instance type
 key_name      = "my-key-pair"             # Replace with your key pair name
 # Additional attributes as per the `terraform show` output
 }

Step 7: Apply Configuration Changes

Now that your configuration file accurately reflects the imported resource, you can manage it with Terraform. Run terraform plan to see the planned actions:

$ terraform plan

If everything looks good, apply the changes:

$ terraform apply

Step 8: Manage Your Infrastructure

You can now manage your imported resource using Terraform. For example, you can update the instance type or other attributes in main.tf and apply the changes with terraform apply.

Considerations When Working with Imported Resources

While Terraform import offers a powerful way to manage existing infrastructure, there are some key considerations to keep in mind:

  • Configuration matching: Terraform relies on its configuration to manage resources. When importing a resource, ensure the Terraform configuration accurately reflects the existing resource's attributes. Any mismatch between the configuration and the actual resource can lead to unexpected behavior or errors during import or subsequent management.
  • State management: Terraform stores the state of your infrastructure, including imported resources, in a state file. This file is essential for Terraform to track resources and manage their lifecycle. Here's how to ensure proper state management:
    • Secure the state file: The state file contains sensitive information about your infrastructure resources. Implement appropriate security measures to protect it from unauthorized access. Consider storing the state file in a secure location like a dedicated backend like Terraform Cloud or Terraform Enterprise.
    • Regular backups: Regularly back up your state file to prevent data loss in case of accidental deletion or corruption. Having a backup allows you to restore the state if needed.

Best Practices for Managing Imported Resources

Following these best practices ensures you effectively manage your imported resources alongside those defined in Terraform code:

  1. Verification after import: After a successful import, verify that the imported resource's attributes within the Terraform state match the actual resource's configuration. Use the terraform show command to inspect the imported resource and compare it to the resource details obtained from your cloud provider's console or API.
  2. Configuration updates: Resources can be modified outside of Terraform after they’re imported. It's important to update the Terraform configuration to reflect any changes made to the resource's attributes. This ensures Terraform has an accurate representation of your infrastructure and allows you to manage the resource effectively using Terraform.
  3. Import documentation: Maintain clear documentation for imported resources. This documentation should detail:
    • The type of resource imported (e.g., AWS EC2 instance)
    • The identifier of the imported resource (e.g., instance ID)
    • The steps taken during the import process
    • Any specific considerations or notes related to the import    

Conclusion

Terraform import bridges the gap between existing infrastructure and Terraform's management power. It enables you to seamlessly integrate your entire infrastructure stack, regardless of creation method. This unified approach reduces complexity, improves visibility, and streamlines infrastructure management.

As your infrastructure evolves, storage becomes a critical consideration. Explore Everpure solutions, like Portworx® for containerized workloads and Everpure Cloud Dedicated for cloud deployments, to optimize storage management alongside Terraform. This combination ensures efficient, scalable infrastructure for your modern applications.

10/2025
Virtual Machine Provisioning at Enterprise Scale | Everpure
Sizing and scaling Red Hat OpenShift Virtualization with Portworx.
White Paper
22 pages

Browse key resources and events

SAVE THE DATE
Pure//Accelerate® 2026
June 16-18, 2026 | Resorts World Las Vegas

Mark your calendars. Registration opens in February.

Learn More
PURE360 DEMOS
Explore, learn, and experience Everpure.

Access on-demand videos and demos to see what Everpure can do.

Watch Demos
VIDEO
Watch: The value of an Enterprise Data Cloud

Charlie Giancarlo on why managing data—not storage—is the future. Discover how a unified approach transforms enterprise IT operations.

Watch Now
RESOURCE
Legacy storage can’t power the future

Modern workloads demand AI-ready speed, security, and scale. Is your stack ready?

Take the Assessment
Your Browser Is No Longer Supported!

Older browsers often represent security risks. In order to deliver the best possible experience when using our site, please update to any of these latest browsers.

Personalize for Me
Steps Complete!
1
2
3
Personalize your Everpure experience
Select a challenge, or skip and build your own use case.
Future-proof virtualization strategies

Storage options for all your needs

Enable AI projects at any scale

High-performance storage for data pipelines, training, and inferencing

Protect against data loss

Cyber resilience solutions that defend your data

Reduce cost of cloud operations

Cost-efficient storage for Azure, AWS, and private clouds

Accelerate applications and database performance

Low-latency storage for application performance

Reduce data center power and space usage

Resource efficient storage to improve data center utilization

Confirm your outcome priorities
Your scenario prioritizes the selected outcomes. You can modify or choose next to confirm.
Primary
Reduce My Storage Costs
Lower hardware and operational spend.
Primary
Strengthen Cyber Resilience
Detect, protect against, and recover from ransomware.
Primary
Simplify Governance and Compliance
Easy-to-use policy rules, settings, and templates.
Primary
Deliver Workflow Automation
Eliminate error-prone manual tasks.
Primary
Use Less Power and Space
Smaller footprint, lower power consumption.
Primary
Boost Performance and Scale
Predictability and low latency at any size.
What’s your role and industry?
We've inferred your role based on your scenario. Modify or confirm and select your industry.
Select your industry
Financial services
Government
Healthcare
Education
Telecommunications
Automotive
Hyperscaler
Electronic design automation
Retail
Service provider
Transportation
Which team are you on?
Technical leadership team
Defines the strategy and the decision making process
Infrastructure and Ops team
Manages IT infrastructure operations and the technical evaluations
Business leadership team
Responsible for achieving business outcomes
Security team
Owns the policies for security, incident management, and recovery
Application team
Owns the business applications and application SLAs
Describe your ideal environment
Tell us about your infrastructure and workload needs. We chose a few based on your scenario.
Select your preferred deployment
Hosted
Dedicated off-prem
On-prem
Your data center + edge
Public cloud
Public cloud only
Hybrid
Mix of on-prem and cloud
Select the workloads you need
Databases
Oracle, SQL Server, SAP HANA, open-source

Key benefits:

  • Instant, space-efficient snapshots

  • Near-zero-RPO protection and rapid restore

  • Consistent, low-latency performance

 

AI/ML and analytics
Training, inference, data lakes, HPC

Key benefits:

  • Predictable throughput for faster training and ingest

  • One data layer for pipelines from ingest to serve

  • Optimized GPU utilization and scale
Data protection and recovery
Backups, disaster recovery, and ransomware-safe restore

Key benefits:

  • Immutable snapshots and isolated recovery points

  • Clean, rapid restore with SafeMode™

  • Detection and policy-driven response

 

Containers and Kubernetes
Kubernetes, containers, microservices

Key benefits:

  • Reliable, persistent volumes for stateful apps

  • Fast, space-efficient clones for CI/CD

  • Multi-cloud portability and consistent ops
Cloud
AWS, Azure

Key benefits:

  • Consistent data services across clouds

  • Simple mobility for apps and datasets

  • Flexible, pay-as-you-use economics

 

Virtualization
VMs, vSphere, VCF, vSAN replacement

Key benefits:

  • Higher VM density with predictable latency

  • Non-disruptive, always-on upgrades

  • Fast ransomware recovery with SafeMode™

 

Data storage
Block, file, and object

Key benefits:

  • Consolidate workloads on one platform

  • Unified services, policy, and governance

  • Eliminate silos and redundant copies

 

What other vendors are you considering or using?
Thinking...
Your personalized, guided path
Get started with resources based on your selections.