Ash Panwar
Ash Panwar

Reputation: 317

Error with Instance profile role for EMR?

I am trying to build an EMR cluster through terraform. But I am getting following error on applying the code. IAM_EMR_for_EC2 is the instance profile role I created for EC2 in the cluster to assume.

1 error(s) occurred:

  • aws_emr_cluster.tf-test-cluster: 1 error(s) occurred:

  • aws_emr_cluster.tf-test-cluster: ValidationException: Instance profile 'arn:aws:iam:::role/IAM_EMR_for_EC2' is not well-formed. Expected a resource of type INSTANCE_PROFILE. status code: 400, request id: 6bd4461c-637f-11e8-8605-c930816c10b8

Could someone help me as I am not able to understand this error nor I could it find any details on google.

Upvotes: 4

Views: 8679

Answers (2)

Yegor  Dovganich
Yegor Dovganich

Reputation: 108

You should write instance_profile = "${aws_iam_instance_profile.emr_profile.arn}".

And also create emr_profile resource: resource "aws_iam_instance_profile" "emr_profile" { name = "emr_profile" role = "${aws_iam_role.EMR_EC2_DefaultRole.name}" }

Upvotes: 2

d1ll1nger
d1ll1nger

Reputation: 1701

You're applying a role rather than an instance profile, they are actually different. The ARN needs to be in the format of arn:aws:iam::336924118301:instance-profile/ExampleInstanceProfile.

A role needs to be attached to an instance profile resource.

Upvotes: 5

Related Questions