Skip to content

Commit 00f076a

Browse files
authored
feat: Starting with 1.30, do not use the cluster OIDC issuer URL by default in the identity provider config (#3055)
fix: Starting with `1.30`, do not use the cluster OIDC issuer URL by default in the identity provider config
1 parent 59024eb commit 00f076a

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

docs/UPGRADE-19.0.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,12 @@ EKS managed node groups on `v18.x` by default create a security group that does
364364
365365
# OIDC Identity provider
366366
cluster_identity_providers = {
367-
sts = {
368-
client_id = "sts.amazonaws.com"
367+
cognito = {
368+
client_id = "702vqsrjicklgb7c5b7b50i1gc"
369+
issuer_url = "https://cognito-idp.us-west-2.amazonaws.com/us-west-2_re1u6bpRA"
370+
username_claim = "email"
371+
groups_claim = "cognito:groups"
372+
groups_prefix = "gid:"
369373
}
370374
}
371375

main.tf

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,14 @@ resource "aws_eks_addon" "before_compute" {
552552
# Note - this is different from IRSA
553553
################################################################################
554554

555+
locals {
556+
# Maintain current behavior for <= 1.29, remove default for >= 1.30
557+
# `null` will return the latest Kubernetes version from the EKS API, which at time of writing is 1.30
558+
# https://github.com/kubernetes/kubernetes/pull/123561
559+
idpc_backwards_compat_version = contains(["1.21", "1.22", "1.23", "1.24", "1.25", "1.26", "1.27", "1.28", "1.29"], coalesce(var.cluster_version, "1.30"))
560+
idpc_issuer_url = local.idpc_backwards_compat_version ? try(aws_eks_cluster.this[0].identity[0].oidc[0].issuer, null) : null
561+
}
562+
555563
resource "aws_eks_identity_provider_config" "this" {
556564
for_each = { for k, v in var.cluster_identity_providers : k => v if local.create && !local.create_outposts_local_cluster }
557565

@@ -562,10 +570,11 @@ resource "aws_eks_identity_provider_config" "this" {
562570
groups_claim = lookup(each.value, "groups_claim", null)
563571
groups_prefix = lookup(each.value, "groups_prefix", null)
564572
identity_provider_config_name = try(each.value.identity_provider_config_name, each.key)
565-
issuer_url = try(each.value.issuer_url, aws_eks_cluster.this[0].identity[0].oidc[0].issuer)
566-
required_claims = lookup(each.value, "required_claims", null)
567-
username_claim = lookup(each.value, "username_claim", null)
568-
username_prefix = lookup(each.value, "username_prefix", null)
573+
# TODO - make argument explicitly required on next breaking change
574+
issuer_url = try(each.value.issuer_url, local.idpc_issuer_url)
575+
required_claims = lookup(each.value, "required_claims", null)
576+
username_claim = lookup(each.value, "username_claim", null)
577+
username_prefix = lookup(each.value, "username_prefix", null)
569578
}
570579

571580
tags = merge(var.tags, try(each.value.tags, {}))

0 commit comments

Comments
 (0)