Skip to content

Instantly share code, notes, and snippets.

@jpfielding
Created May 21, 2021 20:27
Show Gist options
  • Save jpfielding/5d3ce5e67840b34f3876caf2d24a14fd to your computer and use it in GitHub Desktop.
Save jpfielding/5d3ce5e67840b34f3876caf2d24a14fd to your computer and use it in GitHub Desktop.
Generate a aws-auth iam for the mapUsers section
# https://github.com/kubernetes-sigs/aws-iam-authenticator/issues/176
data "aws_caller_identity" "current" {}
data "aws_iam_group" "ops" {
group_name = "Ops"
}
provider "aws" {
profile = var.aws_profile
region = var.aws_region
}
output "users" {
value = [
for user in data.aws_iam_group.ops.users :
{
user_arn = join("", ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/", user.user_name])
username = user.user_name
group = "system:masters"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment