-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix: Correct logic to try to use module created IAM role before falli… #3433
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
Merged
bryantbiggs
merged 3 commits into
terraform-aws-modules:master
from
bryantbiggs:fix/auto-mode
Jul 24, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ resource "aws_eks_cluster" "this" { | |
content { | ||
enabled = compute_config.value.enabled | ||
node_pools = compute_config.value.node_pools | ||
node_role_arn = compute_config.value.node_pools != null ? try(compute_config.value.node_role_arn, aws_iam_role.eks_auto[0].arn, null) : null | ||
node_role_arn = compute_config.value.node_pools != null ? try(aws_iam_role.eks_auto[0].arn, compute_config.value.node_role_arn) : null | ||
} | ||
} | ||
|
||
|
@@ -444,7 +444,7 @@ data "tls_certificate" "this" { | |
# Not available on outposts | ||
count = local.create_oidc_provider && var.include_oidc_root_ca_thumbprint ? 1 : 0 | ||
|
||
url = local.dualstack_oidc_issuer_url | ||
url = aws_eks_cluster.this[0].identity[0].oidc[0].issuer | ||
} | ||
|
||
resource "aws_iam_openid_connect_provider" "oidc_provider" { | ||
|
@@ -453,7 +453,7 @@ resource "aws_iam_openid_connect_provider" "oidc_provider" { | |
|
||
client_id_list = distinct(compact(concat(["sts.amazonaws.com"], var.openid_connect_audiences))) | ||
thumbprint_list = concat(local.oidc_root_ca_thumbprint, var.custom_oidc_thumbprints) | ||
url = local.dualstack_oidc_issuer_url | ||
url = aws_eks_cluster.this[0].identity[0].oidc[0].issuer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
tags = merge( | ||
{ Name = "${var.name}-eks-irsa" }, | ||
|
@@ -856,7 +856,7 @@ resource "aws_eks_identity_provider_config" "this" { | |
client_id = each.value.client_id | ||
groups_claim = each.value.groups_claim | ||
groups_prefix = each.value.groups_prefix | ||
identity_provider_config_name = try(each.value.identity_provider_config_name, each.key) | ||
identity_provider_config_name = coalesce(each.value.identity_provider_config_name, each.key) | ||
issuer_url = each.value.issuer_url | ||
required_claims = each.value.required_claims | ||
username_claim = each.value.username_claim | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
compute_config.value.node_role_arn
is specified (module input), then is it guaranteed thataws_iam_role.eks_auto[0].arn
will benull
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will not be
null
- this would throw an error ifcreate_node_iam_role = false
which is whattry()
catches and moves down the chain tocompute_config.value.node_role_arn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From
and
and
I think this change is still not right. If I understand correctly, the
compute_config.value.node_role_arn
module input will never be used. For this to be correct you need to modifylocal.create_node_iam_role
to be true only ifcompute_config.value.node_role_arn
is not specified.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can think its not right, but I can tell you it is 😬
the previous form for the initial v21 release did not work because
try()
only falls down the chain when it encounters errors. Plucking a value offcompute_config.value.node_role_arn
does not throw an error because of the new variable optional attributes; it simply returns anull
and never moves down the chainThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I set
var.compute_config.node_role_arn
to a value then I also have to setvar.create_node_iam_role
tofalse
, is that the intended use?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, easy there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right back at ya 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes! 🙏