Hey Adam –
You can create a LB Target group, and an EC2 Instance, and then attach them with aws_lb_target_group_attachment as you mention. Put those three in a configuration file then `terraform plan` and `terraform apply`.
For detach, remove aws_lb_target_group_attachment from the configuration (or perhaps change which instance is in the attachment). Run `terraform plan` to verify the plan to detach that instance, then `terraform apply` to complete it.
Please let me know if thats not what you're looking for.
Cheers,
Clint