Oops, I Deleted the AWS Auth Roles: My EKS Misadventure

Oguzhan Coskun
DevOps.dev
Published in
3 min readAug 28, 2024

Managing an EKS cluster is usually simple, but sometimes things can go wrong. In my case, it all started when I wanted to update our Terraform configuration. This led to a stressful situation where I lost access to the cluster. I had to work hard to fix it and learned some important lessons along the way.

The Setup

We were running our Kubernetes cluster on EKS version 1.23 and managing it with Terraform. At first, we used this module to create managed node groups:

source = "terraform-aws-modules/eks/aws//modules/eks-managed-node-group"
version = "19.15.2"

We created the node groups separately using a submodule. However, we decided to simplify our setup by managing the node groups directly with the EKS module, without using a submodule:

source  = "terraform-aws-modules/eks/aws"
version = "19.21.0"

At the same time, we defined our aws_auth_roles within the EKS module:

aws_auth_roles = [
{
rolearn = "arn:aws:iam::${var.aws_account_id}:role/rolename"
username = "username"
groups = ["system:masters"]
},
...
]

The Problem

Everything looked simple until Terraform tried to apply these changes. The first thing Terraform did…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Solutions Architect, #AWS, food, chess, books, philosophy, etymology