Amazon EKS now allows you to assign IAM permissions to Kubernetes service accounts.
This is achieved via an OIDC Issuer URL exposed on an EKS Cluster.
aws_eks_cluster
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
Announcement.
API reference.
Blog post.
AWS containers roadmap issue.
Requires AWS SDK v1.23.15:
I will have the new attributes and an example submitted shortly. ๐ e.g.
resource "aws_eks_cluster" "example" {
# ... other configuration ...
}
resource "aws_iam_openid_connect_provider" "example" {
client_id_list = ["sts.amazonaws.com"]
thumbprint_list = []
url = "${aws_eks_cluster.example.identity.0.oidc.0.issuer}"
}
data "aws_iam_policy_document" "example_assume_role_policy" {
statement {
actions = ["sts:AssumeRoleWithWebIdentity"]
effect = "Allow"
condition {
test = "StringEquals"
variable = "${replace(aws_iam_openid_connect_provider.example.url, "https://", "")}:sub"
values = ["system:serviceaccount:kube-system:aws-node"]
}
principals {
identifiers = ["${aws_iam_openid_connect_provider.example.arn}"]
type = "Federated"
}
}
}
resource "aws_iam_role" "example" {
assume_role_policy = "${data.aws_iam_policy_document.example_assume_role_policy.json}"
name = "example"
}
Pull request submitted: https://github.com/terraform-providers/terraform-provider-aws/pull/10006
Pull request submitted: #10006
Can we please get that reviewed and merge asap ;)? So, I can finally remove kube2iam.
The functionality to retrieve the OIDC issuer URL from the aws_eks_cluster
resource and data source has been merged and will release with version 2.28.0 of the Terraform AWS Provider, on Thursday. ๐
This has been released in version 2.28.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
The functionality to retrieve the OIDC issuer URL from the
aws_eks_cluster
resource and data source has been merged and will release with version 2.28.0 of the Terraform AWS Provider, on Thursday. ๐