fix: Allow for both amazonaws.com.cn and amazonaws.com conditions in PassRole as required for AWS CN#3422
Merged
Conversation
added 2 commits
July 17, 2025 10:25
…red for AWS CN - set in correct policy
amazonaws.com.cn and amazonaws.com conditions in PassRole as required for AWS CN
amazonaws.com.cn and amazonaws.com conditions in PassRole as required for AWS CNamazonaws.com.cn and amazonaws.com conditions in PassRole as required for AWS CN
83b68fd
into
terraform-aws-modules:master
24 of 26 checks passed
antonbabenko
pushed a commit
that referenced
this pull request
Jul 17, 2025
## [20.37.2](v20.37.1...v20.37.2) (2025-07-17) ### Bug Fixes * Allow for both `amazonaws.com.cn` and `amazonaws.com` conditions in PassRole as required for AWS CN ([#3422](#3422)) ([83b68fd](83b68fd))
Member
|
This PR is included in version 20.37.2 🎉 |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
AWS CN requires both service principals in the IAM policy passrole condition. Added ec2.amazonaws.com as a default principal.
Motivation and Context
Fails to create EC2NodeClasses without this change in AWS CN
{"level":"ERROR","time":"2025-07-17T09:48:10.169Z","logger":"controller","message":"Reconciler error","commit":"a2875e3","controller":"nodeclass.status","controllerGroup":"karpenter.k8s.aws","controllerKind":"EC2NodeClass","EC2NodeClass":{"name":"gpu"},"namespace":"","name":"gpu","reconcileID":"f6a8cdf5-e6c3-4329-bf32-fa1973febf1a","error":"creating instance profile, adding role \"staging-cn-nw-1-kpt-eks-node-group-20250716100915634200000001\" to instance profile \"staging-cn-nw-1-eks_14906149492098168839\", AccessDenied: User: arn:aws-cn:sts::XXX:assumed-role/KarpenterController-20250716132851685200000005/1752742098653173128 is not authorized to perform: iam:PassRole on resource: arn:aws-cn:iam::XXX:role/staging-cn-nw-1-kpt-eks-node-group-20250716100915634200000001 because no identity-based policy allows the iam:PassRole action\n\tstatus code: 403, request id: 0bce511a-7372-4cdb-9585-3415f44102bc"}Noted in issue #3389, and same fix applied in cloudformation for karpenter aws/karpenter-provider-aws#6839
Resolves #3389
How Has This Been Tested?
Applied to a new cluster in AWS CN cn-northwest-1 region.
pre-commit run -aon my pull request