Skip to content

Conversation

oarbusi
Copy link
Collaborator

@oarbusi oarbusi commented Oct 1, 2025

Description

This is a backport of #3718 into v1 branch

Link to any related issue(s): CLOUDP-347906 & CLOUDP-348399

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

…on (#3718)

* update provider to infer region from sts_endpoint

* changelog

* fmt

* nit

* nit

* fmt

* unit tests

* test

* nit

* nit

* nit

* improve clarity of comment

* use asserts in unit test

* use const instead of magic number

---------

Co-authored-by: Oriol Arbusi Abadal <[email protected]>
@github-actions github-actions bot added the bug label Oct 1, 2025
@oarbusi oarbusi marked this pull request as ready for review October 1, 2025 10:26
@oarbusi oarbusi requested review from a team as code owners October 1, 2025 10:26
@Copilot Copilot AI review requested due to automatic review settings October 1, 2025 10:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes STS region resolution issues when using cross-region authentication in the MongoDB Atlas Terraform provider. The changes address problems where STS endpoint regions weren't being properly derived and handled in cross-region scenarios.

  • Refactors STS endpoint resolution logic to properly parse and derive regions from endpoints
  • Adds comprehensive test coverage for STS region derivation and endpoint resolution
  • Enhances CI workflow to test cross-region authentication scenarios

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/provider/credentials.go Refactors STS endpoint resolution with new functions to properly derive regions from endpoints
internal/provider/credentials_test.go Adds comprehensive test suite for STS region derivation and endpoint resolution functions
.github/workflows/acceptance-tests-runner.yml Enhances CI to test multiple cross-region authentication scenarios with matrix strategy
.changelog/3731.txt Documents the bug fix in the changelog

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

github-actions bot commented Oct 1, 2025

APIx bot: a message has been sent to Docs Slack channel

@oarbusi oarbusi changed the base branch from master to master-v1 October 1, 2025 10:29
@@ -0,0 +1,3 @@
```release-note:bug
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd add it's a backport in the PR title

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@oarbusi oarbusi changed the title fix: Fixes STS region resolution when using cross-region authentication (#3718) fix: Backport of "Fixes STS region resolution when using cross-region authentication (#3718)" Oct 1, 2025
@oarbusi oarbusi merged commit a5691d0 into master-v1 Oct 1, 2025
57 checks passed
@oarbusi oarbusi deleted the CLOUDP-348399-sts-backport branch October 1, 2025 12:48
Copy link
Contributor

@jvincent-mongodb jvincent-mongodb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants