Skip to content

Commit d89b68a

Browse files
committed
refactor(iam-helper): allow IAM keys and profile when auth_profile is used
1 parent 6e922a1 commit d89b68a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

redshift_connector/iam_helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ def set_iam_properties(info: RedshiftProperty) -> RedshiftProperty:
131131
)
132132

133133
if info.credentials_provider is not None:
134-
if any((info.access_key_id, info.secret_access_key, info.session_token, info.profile)):
134+
if info.auth_profile is None and any(
135+
(info.access_key_id, info.secret_access_key, info.session_token, info.profile)
136+
):
135137
raise InterfaceError(
136138
"Invalid connection property setting. It is not valid to provide both Credentials provider and "
137139
"AWS credentials or AWS profile"
@@ -142,7 +144,7 @@ def set_iam_properties(info: RedshiftProperty) -> RedshiftProperty:
142144
"credentials_provider."
143145
)
144146
elif info.profile is not None:
145-
if any((info.access_key_id, info.secret_access_key, info.session_token)):
147+
if info.auth_profile is None and any((info.access_key_id, info.secret_access_key, info.session_token)):
146148
raise InterfaceError(
147149
"Invalid connection property setting. It is not valid to provide any of access_key_id, "
148150
"secret_access_key, or session_token when profile is provided"

0 commit comments

Comments
 (0)