How to attach existing EC2 instances to auto scaling group in terraform?

Viewed 1095

I created 2 EC2 instances using terraform. Is there any way to attach them into auto scaling group using terraform? I didn't find anything about this in the docs :/

I don't want to create them within the ASG, only attached them. As I said the instances were generated by terraform script as well as everything else (ASG, SG...).

Thank you

1 Answers

Unfortunately this is not possible via Terraform directly

However you could run the attach-instances AWS cli command.

If this needed to be performed in terraform you could put the command into a local-exec resource.

Related