Skip to content

Instantly share code, notes, and snippets.

@NassK
Last active October 11, 2020 22:37
Show Gist options
  • Save NassK/d7358124125f5d97f990a63ef8a3d17d to your computer and use it in GitHub Desktop.
Save NassK/d7358124125f5d97f990a63ef8a3d17d to your computer and use it in GitHub Desktop.
step_5.tf
# Step 5: Integrating Service Accounts with IAM role
data "tls_certificate" "cluster" {
url = aws_eks_cluster.cluster.identity.0.oidc.0.issuer
}
resource "aws_iam_openid_connect_provider" "cluster" { # We need an open id connector to allow our service account to assume an IAM role
client_id_list = ["sts.amazonaws.com"]
thumbprint_list = concat([data.tls_certificate.cluster.certificates.0.sha1_fingerprint], [])
url = aws_eks_cluster.cluster.identity.0.oidc.0.issuer
}
variable "region" {
description = "The AWS region"
default = "eu-west-1"
}
variable "cluster_name" {
description = "The name of the Amazon EKS cluster."
default = "my-eks-cluster"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment