I’ve attempted to research the following in google but surprisingly I haven’t found a straight forward answer:
How would I delete specific EC2 instances by passing the instance id as it appears in AWS? For example, when I used terraform to create my instances, AWS automatically created ids for them such as “i-0XXXXXXXXXXXXXXXX”. Is there a command such as "terraform destroy -id=“i-0XXXXXXXXXXXXXXXX”.
How would I delete multiple EC2 instances by passing the name I specified in the main.tf file? For example, I created 2 resource blocks that say “resource ‘aws_instance’ ‘Udacity_foo’”. How can I pass ‘Udacity_foo’ into a command such as “terraform destroy -name=‘Udacity_foo’”, which would delete all instances matching Udacity_foo as terraform recognizes it.
Are tasks 1 and 2 above possible by using a terraform configuration file? For example, I could write “instances_to_delete.tf” and type a command such as "terraform destroy -config=‘instances_to_delete.tf’.