How to set an existing IAM role to a new instance while spinning in terraform? I am trying to attach an existing role created in AWS, but I am not able to add it in Terraform Code. I tried to add the role in instance profile but it didn't work either for me.

Is there any direct way to add it in the resource in Terraform Code ? 

iam_instance_profile  = "my-role"


  Note: my-role is having the full access of ec2.
you can add role like below 

role = "${aws_iam_role.ec2_role_name.name}"


Please check - https://www.terraform.io/docs/providers/aws/r/iam_instance_profile.html