All hands-on labs

Premium Hands-on labbeginnerAWS

Importing AWS resources into Terraform

What if you already have resources running in an AWS account, but you want to manage it using Terraform? Learn how to import existing resources into your Terraform configuration files and state using this lab environment.

  • 10 guided tasks

Scenario

What if you already have resources running in your AWS accounts? How can you manage those without starting from scratch?

Or, as another scenario, it's entirely possible that at some point you'll come across resources created outside of Terraform even if you are actively using it. Maybe your company hasn't yet standardized on building with Terraform, and someone on the team didn't want to spend the time writing the code, so they manually deployed it.

Regardless of the situation, if you come across a resource and want to manage it with IaC, it's possible to import existing resources and manage them with Terraform going forward.

In this lab, we'll cover the two approaches we can use to import resources.

What you will learn

  • Import an existing IAM user with the Terraform CLI.
  • Generate resource configuration with an import block.
  • Compare the imported state with your resource configuration.
  • Remove imported users with Terraform.
Hands-on lab

Importing AWS resources into Terraform

Included in Cybr Premium.