Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon EKS Cluster OIDC Issuer URL #9995

Closed
ewbankkit opened this issue Sep 4, 2019 · 6 comments · Fixed by #10006
Closed

Amazon EKS Cluster OIDC Issuer URL #9995

ewbankkit opened this issue Sep 4, 2019 · 6 comments · Fixed by #10006
Assignees
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/eks Issues and PRs that pertain to the eks service.
Milestone

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Sep 4, 2019

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)

Potential Terraform Configuration

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

@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label Sep 4, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 4, 2019
@bflad bflad added service/eks Issues and PRs that pertain to the eks service. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 5, 2019
@bflad
Copy link
Contributor

bflad commented Sep 5, 2019

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"
}

bflad added a commit that referenced this issue Sep 5, 2019
…nd data source

Reference: #9995

Output from acceptance testing:

```
--- PASS: TestAccAWSEksCluster_VpcConfig_SecurityGroupIds (1211.77s)
--- PASS: TestAccAWSEksCluster_basic (1234.32s)
--- PASS: TestAccAWSEksClusterDataSource_basic (1253.87s)
--- PASS: TestAccAWSEksCluster_Logging (1298.73s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPublicAccess (1489.44s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPrivateAccess (1875.19s)
--- PASS: TestAccAWSEksCluster_Version (2292.24s)
```
@bflad
Copy link
Contributor

bflad commented Sep 5, 2019

Pull request submitted: #10006

@bflad bflad self-assigned this Sep 5, 2019
@marcincuber
Copy link

marcincuber commented Sep 6, 2019

Pull request submitted: #10006

Can we please get that reviewed and merge asap ;)? So, I can finally remove kube2iam.

@bflad bflad added this to the v2.28.0 milestone Sep 6, 2019
@bflad
Copy link
Contributor

bflad commented Sep 6, 2019

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

@ghost
Copy link

ghost commented Sep 12, 2019

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!

@ghost
Copy link

ghost commented Nov 1, 2019

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!

@ghost ghost locked and limited conversation to collaborators Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/eks Issues and PRs that pertain to the eks service.
Projects
None yet
3 participants