How can I use Terraform to modify the instance profile of an existing EC2 instance?

I didn’t specify an instance profile when creating it, and now I want to update it to a newly created instance profile.

The best way is import your resource and change it.