Hey, I just wanted to know that If I had already some existed roles on AWS then Can I connect those roles to my ec2 instance which I am creating using Terraform And Same thing goes for policies like when we are creating any role using terraform then can I attach aws existing policy to it.
Yes. You just need to use their ARNs
@stuart-c Is there any docs regarding this thing ?
What sort of documentation are you looking for? If you look at the aws_instance documentation (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) you can see the
iam_instance_profile attribute expects the ARN of an instance profile to use for the EC2 instance.