https://www.coachdevops.com/2021/06/h...
The terraform import command is used to import existing infrastructure. The command currently can only import one resource at a time. This means you can't yet point Terraform import to an entire collection of resources such as an AWS VPC and import all of it.
Let's say that you have created EC2 instances manually outside Terraform. If you like to import your EC2 instance to Terraform you can use import command and bring it under Terraform state file.
To import a resource, create a tf file first write a resource block for it in your configuration, establishing the name by which it will be known to Terraform:
sudo vi myec2.tf
resource "aws_instance" "myinstance" {
...instance configuration...leave this as it is
}
Watch video How to import existing AWS resources into Terraform? | Terraform Import existing AWS Resources online without registration, duration hours minute second in high quality. This video was added by user DevOps Coach 08 June 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 20,643 once and liked it 187 people.