Hi Team ,
I am new to terraform world, created some basic scripts of deployment ec2 in AWS. I would like to know how can I use terraform to manage existing aws resources which created by other means , like manual.
I have created ec2 instances with terraform, but elbs are pre-exists and I need to attach my ec2 instances under the elb , trying to do that with terraform, not sure how to do that. Could you please help me on this please?
Thanks
Suddhasil
@suddhasilsarkar , you can import your existing infrastructure and then manage it via Terraform. Take a look on:
Many thanks @pavel-snyk this helps. I could able to import eixsting elb. Now I was planning to add the ec2s I have created part of tf script, while running plan I see its showing as below. does it mean its going to detach the existing nodes?
Please let me know on this, and also if any questions, please.
Thanks for all help here
Thanks
Suddhasil
From the screenshot you attached, you can see that the LB will be re-attached (from 4 existing EC2 instance to other EC2 instance).
So I guess you should import these EC2 instances into Terraform as well. Ideally you don’t have any changes at all.
Yeah there is challenge, so the 4 existing instances I only created part of the script , but here it seems like its going to remove the existing one from elb , not sure why, I can not test this in prod ( given env). I will check this out in the test environment ,ideally it should call the existing instances only which means, no change in actual execution.