title: Terraform: ECS service - InvalidParameterException
body: <p>I am trying to provision an ECS cluster with terraform, everything seems to work well up until I am creating the ecs service:</p>
  
  <pre><code>resource "aws_ecs_service" "ecs-service" {
    name            = "ecs-service"
    iam_role        = "${aws_iam_role.ecs-service-role.name}"
    cluster         = "${aws_ecs_cluster.ecs-cluster.id}"
    task_definition = "${aws_ecs_task_definition.my_cluster.family}"
    desired_count   = 1
  
    load_balancer {
      target_group_arn  = "${aws_alb_target_group.ecs-target-group.arn}"
      container_port    = 80
      container_name    = "my_cluster"
    }
  }
  </code></pre>
  
  <p>and the IAM role is:</p>
  
  <pre><code>resource "aws_iam_role" "ecs-service-role" {
    name = "ecs-service-role"
  
    assume_role_policy = &lt;&lt;EOF
  {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Action": "sts:AssumeRole",
        "Principal": {
          "Service": "ec2.amazonaws.com"
        },
        "Effect": "Allow",
        "Sid": ""
      }
    ]
  }
  EOF
  }
  
  resource "aws_iam_role_policy_attachment" "ecs-service-role-attachment" {
      role       = "${aws_iam_role.ecs-service-role.name}"
      policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceRole"
  }
  </code></pre>
  
  <p>I am getting the following error message:</p>
  
  <blockquote>
    <ul>
    <li><p>aws_ecs_service.ecs-service: 1 error(s) occurred:</p></li>
    <li><p>aws_ecs_service.ecs-service: InvalidParameterException: Unable to assume role and validate the specified targetGroupArn. Please verify
    that the ECS service role being passed has the proper permissions.</p></li>
    </ul>
  </blockquote>