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.


1 Answer 1


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.