I'm building an infrastructure for a project I have, and I wonder if Terraform can get ec2's state. Basically, I need to create an ec2 with all the requirements, generate it to an AMI, and create an ASG. I want that the ec2 would stop after it's ready and only then to continue with the steps (AMI and ASG). Does anyone have any experience with that? help would be much appreciated Thanks!
You can use "null_resource" with local-exec provisioner to run AMI creation, the local exec run will complete only after ami is ready. You can then provision ASG