Cannot attach a Service Role Policy to a Customer Role

I am using terraform to create a role to use for EKS, but I am getting an error that says “Cannot attach a Service Role Policy to a Customer Role”, so I assume I am setting up my IAM role incorrectly. Can anyone see what I am doing wrong here?

terraform {
  required_providers  {
    aws = {
      source = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

resource "aws_iam_role" "eks_service_role_primary" {
  name = "eks_service_role_primary"
  assume_role_policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "eks.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
EOF
}

resource "aws_iam_role_policy_attachment" "eks_policy_attachment_primary" {
  role = "${aws_iam_role.eks_service_role_primary.name}"
  policy_arn = "arn:aws:iam::aws:policy/aws-service-role/AmazonEKSServiceRolePolicy"
}

It seems if I attach the role through AWS Management Console, it works fine though, so maybe it’s something else I amd oing.

Did you check the specific resource aws_iam_service_linked_role?
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_service_linked_role