Terraform is a powerful tool to have in your toolset.

It’s effortless to use, for creating new infrastructure, but not so much for importing existing infrastructure, and hopefully, this post will demystify some of these complexities!


Why would you desire to import existing infrastructure?

Because like everything else in life, it is sometimes impossible to plan for the future. Without adequate planning with the creation of infrastructure, it can lead to situations where infrastructure needs to be created manually due to time pressures, emergency releases or just the fact that the infrastructure exists, and terraform was never used in the first instance.

It’s worth reiterating that its always much simpler to create the terraform first, you would only ever import when you need to do something reactive, like an emergency release

Before the terraform import is run, two places can be used as a starting point:

  • The terraform resource definition exists in code and just needs to be imported.
  • The terraform resource does not exist; you need to import it so that you can backfill the terraform resource.

#best-practices #devops #terraform #infrastructure-as-code

Importing Existing Infrastructure into Terraform
1.45 GEEK