Retrieve current AWS configuration

Hello,

I would like to confirm that terraform can evaluate and retrieve current configuration on AWS cloud. In other words, if I have an infrastructure (EC2, ALB, S3, ECS, Lambda, Cloudwatch) hosted in AWS, will terraform retrieve all configuration details and save them in template. By having this, can it be used in another enviroment, by setting up a new replica?

thank you.

I’m not sure if I completely follow your intended use case, but Terraform can import your existing resources though it doesn’t do so by default. I’ve used this method to write Terraform files to represent what I’ve already gotten deployed via other means. In particular I used this method to rewrite what I originally deployed via Cloudformation stacks and then once the Terraform code could be applied without any changes I removed the Cloudformation stack and reapplied using Terraform.

my intention is to have all aforementioned configured services moved to a template that will be used to another AWS region. Using this terraform template I could create the new environment. By that, I will be able to have two identical environments in two different regions. Is this feasible?

Yeah that isn’t anything Terraform will do automatically. You would have to create the Terraform files that represent your existing environment and then you could use them to create an identical environment in another region.