EMR 的实例配置文件角色出错?

Error with Instance profile role for EMR?

我正在尝试通过 Terraform 构建 EMR 集群。但是我在应用代码时遇到以下错误。 IAM_EMR_for_EC2 是我为集群中的 EC2 创建的要承担的实例配置文件角色。

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

有人可以帮助我吗,因为我无法理解此错误,也无法在 google.

上找到任何详细信息

您应用的是角色而不是实例配置文件,它们实际上是不同的。 ARN 需要采用 arn:aws:iam::336924118301:instance-profile/ExampleInstanceProfile.

的格式

角色需要附加到实例配置文件资源。

你应该写instance_profile = "${aws_iam_instance_profile.emr_profile.arn}".

并创建 emr_profile 资源: resource "aws_iam_instance_profile" "emr_profile" { name = "emr_profile" role = "${aws_iam_role.EMR_EC2_DefaultRole.name}" }