hands-on lab

Importing Existing Infrastructure into Terraform

Beginner
Up to 30m
2,812
4.6/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.
Lab description

Terraform is a great way to deploy and manage infrastructure. But what about the existing infrastructure that has been deployed and managed manually? One of the main principles of infrastructure development is to "define everything in code'. To fully reap the benefits of operating your infrastructure through Terraform, pre-existing infrastructure should be managed and used in the same manner to prevent one-off environments and reduce risk. This often takes time and effort and is usually a considerable-sized project to migrate old infrastructure into Terraform retroactively.

In this lab, you will import pre-existing infrastructure into a Terraform state file managed by Terraform.

Learning objectives

Upon completion of this lab, you will be able to:

  • Understand how existing AWS resources are mapped to a Terraform state file
  • Learn the import process for most Terraform resources

Intended audience

This lab is intended for:

  • Individuals studying to take the HashiCorp Certified: Terraform Associate exam
  • Anyone interested in learning how to use Terraform to manage Cloud Service Providers

Prerequisites

You should be familiar with:

  • Cloud Services
  • DevOps
  • Basic understanding of Terraform state

The following course and lab can be used to fulfill the prerequisites:

Updates

December 22nd, 2023 - Lab updated to utilize CodeTour IDE

April 24th, 2023 - Resolved IDE delay

Environment before

Environment after

About the author
Students
19,539
Labs
42
Courses
1
Learning paths
15

Luke is a Site Reliability Engineer at Microsoft. His background is infrastructure development using Terraform and in 2021 he was awarded the HashiCorp Ambassador award. He is an Azure DevOps Engineer Expert, Azure Administrator Associate, and HashiCorp Certified - Terraform Associate.

Covered topics
Lab steps
Importing AWS Resources into Terraform