Search⌘ K
AI Features

Manipulating State

Understand how to manipulate Terraform state to import existing AWS infrastructure such as VPCs. Learn the import command to bring manually created resources under Terraform management, enabling accurate state tracking and resource control.

Terraform state manipulation

It is important to understand how to manipulate Terraform states. Terraform state can be changed to enable you to do a number of operations such as import existing infrastructure into Terraform, move resources from one Terraform project to another, and correct Terraform if someone manually changes infrastructure behind Terraform’s back.

Create VPC

Let’s learn how to import infrastructure into Terraform that was created outside of Terraform. First, log into AWS and go to VPC. Click the Create VPC button, enter example in the Name tag field and 10.0.0.0/16 as the CIDR ...