Terraform-provider-aws: Amazon EKS Cluster OIDC Issuer URL

Created on 4 Sep 2019  ยท  6Comments  ยท  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

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.

New or Affected Resource(s)

# 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.

References

Announcement.
API reference.
Blog post.
AWS containers roadmap issue.

Requires AWS SDK v1.23.15:

enhancement serviceks

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. ๐Ÿ‘

All 6 comments

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: #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!

Was this page helpful?
0 / 5 - 0 ratings