From 6fb02c4fc430acbde444da0ac93fcc9e55f1cc03 Mon Sep 17 00:00:00 2001 From: Scott Cabrinha Date: Tue, 31 Aug 2021 03:27:04 -0700 Subject: [PATCH] feat: Allow users to add more Audiences to OpenID Connect (#1451) --- README.md | 1 + irsa.tf | 2 +- local.tf | 2 +- variables.tf | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f68082..621202c 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf | [map\_users](#input\_map\_users) | Additional IAM users to add to the aws-auth configmap. See examples/basic/variables.tf for example format. |
list(object({
userarn = string
username = string
groups = list(string)
}))
| `[]` | no | | [node\_groups](#input\_node\_groups) | Map of map of node groups to create. See `node_groups` module's documentation for more details | `any` | `{}` | no | | [node\_groups\_defaults](#input\_node\_groups\_defaults) | Map of values to be applied to all node groups. See `node_groups` module's documentation for more details | `any` | `{}` | no | +| [openid\_connect\_audiences](#input\_openid\_connect\_audiences) | List of OpenID Connect audience client IDs to add to the IRSA provider. | `list(string)` | `[]` | no | | [permissions\_boundary](#input\_permissions\_boundary) | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no | | [subnets](#input\_subnets) | A list of subnets to place the EKS cluster and workers within. | `list(string)` | n/a | yes | | [tags](#input\_tags) | A map of tags to add to all resources. Tags added to launch configuration or templates override these values for ASG Tags only. | `map(string)` | `{}` | no | diff --git a/irsa.tf b/irsa.tf index 9c5d653..9ef8d00 100644 --- a/irsa.tf +++ b/irsa.tf @@ -9,7 +9,7 @@ resource "aws_iam_openid_connect_provider" "oidc_provider" { count = var.enable_irsa && var.create_eks ? 1 : 0 - client_id_list = [local.sts_principal] + client_id_list = local.sts_principal thumbprint_list = [var.eks_oidc_root_ca_thumbprint] url = flatten(concat(aws_eks_cluster.this[*].identity[*].oidc.0.issuer, [""]))[0] diff --git a/local.tf b/local.tf index 9d2d7fd..d31f1c9 100644 --- a/local.tf +++ b/local.tf @@ -44,7 +44,7 @@ locals { ) ec2_principal = "ec2.${data.aws_partition.current.dns_suffix}" - sts_principal = "sts.${data.aws_partition.current.dns_suffix}" + sts_principal = compact(concat(["sts.${data.aws_partition.current.dns_suffix}"], var.openid_connect_audiences)) policy_arn_prefix = "arn:${data.aws_partition.current.partition}:iam::aws:policy" workers_group_defaults_defaults = { diff --git a/variables.tf b/variables.tf index b7d560e..aca69a8 100644 --- a/variables.tf +++ b/variables.tf @@ -393,3 +393,9 @@ variable "wait_for_cluster_timeout" { type = number default = 300 } + +variable "openid_connect_audiences" { + description = "List of OpenID Connect audience client IDs to add to the IRSA provider." + type = list(string) + default = [] +} \ No newline at end of file