Search⌘ K
AI Features

Import Resources

Discover how to import existing remote infrastructure into Terraform's management by capturing resource IDs and using terraform import commands. Understand the limitations of importing, such as which resource types support it, and learn to manage Terraform state files effectively.

Overview

As we go through this course, we may wonder whether Terraform can be used in reverse to manage the control resources we created outside of Terraform.

In this lesson, we are going to do just that by using this sequence of steps:

  • Create some resources.
  • Extract the resource IDs.
  • Lose the Terraform state.
  • Use the resource IDs to import with Terraform.

Importance

Knowing how to import resources while using Terraform can be beneficial in practice, but this lesson could be skipped if we don’t need to use the feature.

Create a remote VPC by hand

We have created and initialized a Terraform module named ltthw_import. Furthermore, we created a subnet and VPC.

Note: You don’t have to run the commands to create ...