sdaberdaku opened a new pull request, #47495:
URL: https://github.com/apache/airflow/pull/47495
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #47470
related: #47470
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
# Summary
This PR introduces a configurable AWS region parameter for Vault
authentication via AWS IAM in the HashiCorp provider. Previously, the
`airflow.providers.hashicorp._internal_client.vault_client._VaultClient._auth_aws_iam()`
method did not pass a region parameter to
`hvac.api.auth_methods.Aws.iam_login()`, causing authentication failures when
Vault was configured with an STS endpoint outside `us-east-1`.
# Changes Introduced
- Added a region parameter to VaultBackend and _VaultClient, allowing users
to specify the AWS region for STS authentication.
- If region is not explicitly provided, it defaults to the region configured
in boto3 (e.g., via environment variables or instance metadata).
- Passed the region parameter to `iam_login()` in hvac.
- Updated tests to validate region configuration.
- Passed the role_id parameter to `iam_login()` even when not using key_id
and secret_id for authentication. If not passed to `iam_login()`, the login
endpoint looks for a role bearing the name of the AMI ID of the EC2 instance
that is trying to login if using the ec2 auth method, or the "friendly name"
(i.e., role name or username) of the IAM principal authenticated. If the name
does not match the Vault role, login fails.
# Related Issue
closes: #47470
**^ Add meaningful description above**
Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information.
In case of fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party
License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a
newsfragment file, named `{pr_number}.significant.rst` or
`{issue_number}.significant.rst`, in
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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]