CTTY commented on code in PR #16794:
URL: https://github.com/apache/iceberg/pull/16794#discussion_r3439190232


##########
aws/src/main/java/org/apache/iceberg/aws/AwsProperties.java:
##########
@@ -493,10 +500,46 @@ private AwsCredentialsProvider credentialsProvider(
       return credentialsProvider(this.clientCredentialsProvider);
     }
 
+    // When a role is configured to be assumed (e.g. via 
AssumeRoleAwsClientFactory), sign requests
+    // with the assumed-role credentials so that they do not diverge from the 
credentials used for
+    // S3, Glue, KMS and DynamoDB. See 
https://github.com/apache/iceberg/issues/16667.
+    if (!Strings.isNullOrEmpty(this.clientAssumeRoleArn)) {
+      return assumeRoleCredentialsProvider();
+    }
+
     // Create a new credential provider for each client
     return DefaultCredentialsProvider.builder().build();
   }
 
+  private StsAssumeRoleCredentialsProvider assumeRoleCredentialsProvider() {
+    Preconditions.checkArgument(
+        !Strings.isNullOrEmpty(this.clientAssumeRoleRegion),
+        "Cannot assume role %s to sign REST requests: %s is required",
+        this.clientAssumeRoleArn,
+        CLIENT_ASSUME_ROLE_REGION);

Review Comment:
   I think we should return here and fall back to `DefaultCredentialsProvider`. 
We can print out a warning message here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to