I am trying to apply my .tf file automatically when my ec2 instance dies.
Is there any way to solve my problem?
I am trying to apply my .tf file automatically when my ec2 instance dies.
Is there any way to solve my problem?
Hi @eeyoontaek,
Terraform itself is just a normal CLI program which only runs when you tell it to run, and so Terraform alone cannot solve this problem.
However, if you set up Terraform to run in some other automation system then you could, in principle, use EC2 lifecycle hooks to trigger running Terraform in that automation system.
The details of setting up Terraform to run in automation and setting up EC2 lifecycle hooks are beyond the scope of what I can describe in detail, but for the first part there is at least a guide giving an overview of some concerns that arise when running Terraform in automation:
Or, if you are just wanting to replace the EC2 instance have you considered using Auto Scaling Groups (ASG)?
Yes, but I want to make terraform as team’s common tool. So we can build bigger structure with terraform.
Thanks for your reply
It really helped me!
Thanks a lot