Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2ecdb60
feat: Adds support for Service Account credentials as provider inputs…
oarbusi Sep 23, 2025
c1ec13b
Merge branch 'master' into CLOUDP-334161-service-accounts-dev
lantoli Sep 25, 2025
78c1a1d
Merge branch 'master' into CLOUDP-334161-service-accounts-dev
lantoli Sep 25, 2025
e42e6c1
chore: Implement Service Account token caching & thread-safe concurre…
lantoli Sep 26, 2025
c9dc4f0
feat: Adds support for JWT Token credentials as provider inputs, envi…
oarbusi Sep 29, 2025
00a7e12
chore: Implement Service Account token refresh policy (#3712)
lantoli Sep 30, 2025
6725d8e
Merge branch 'master' into CLOUDP-334161-service-accounts-dev
lantoli Oct 1, 2025
6a07d68
Merge remote-tracking branch 'origin/master' into CLOUDP-334161-servi…
svc-apix-Bot Oct 3, 2025
394b811
chore: Fix SA dev branch merge (#3744)
lantoli Oct 3, 2025
24a610e
Merge branch 'master' into CLOUDP-334161-service-accounts-dev
lantoli Oct 3, 2025
7d25bf0
Merge remote-tracking branch 'origin/master' into CLOUDP-334161-servi…
svc-apix-Bot Oct 6, 2025
5d09ca0
chore: Implement credential type hierarchy (#3738)
lantoli Oct 6, 2025
f67386b
Merge remote-tracking branch 'origin/master' into CLOUDP-334161-servi…
svc-apix-Bot Oct 6, 2025
8aa6d8a
chore: Remove unneeded Atlas versions (#3752)
lantoli Oct 6, 2025
f46bf9f
chore: Fix some tests in PAK and SA executions (#3765)
lantoli Oct 9, 2025
4a9a670
Merge branch 'master' into CLOUDP-334161-service-accounts-dev
lantoli Oct 9, 2025
028a185
Merge remote-tracking branch 'origin/master' into CLOUDP-334161-servi…
svc-apix-Bot Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3700.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
provider: Supports Service Account as credentials to authenticate the provider
```
3 changes: 3 additions & 0 deletions .changelog/3716.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
provider: Supports Service Account JWT Token as credentials to authenticate the provider
```
3 changes: 3 additions & 0 deletions .changelog/3738.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
provider: Enforces strict hierarchy when selecting the credential source such as AWS Secrets Manager, provider attributes, or environment variables to prevent combining with values from different sources
```
18 changes: 9 additions & 9 deletions .github/workflows/acceptance-tests-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ env:
TF_ACC: 1
TF_LOG: ${{ vars.LOG_LEVEL }}
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
# Only Migration tests are run when a specific previous provider version is set
# If the name (regex) of the test is set, only that test is run
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
# If the name (regex) of the test is set, only that test is run.
# Don't run migration tests if using Service Accounts because previous provider versions don't support SA yet.
# Only Migration tests are run when a specific previous provider version is set.
ACCTEST_REGEX_RUN: ${{ inputs.test_name || inputs.use_sa && '^TestAcc' || inputs.provider_version == '' && '^Test(Acc|Mig)' || '^TestMig' }}
MONGODB_ATLAS_BASE_URL: ${{ inputs.mongodb_atlas_base_url }}
MONGODB_REALM_BASE_URL: ${{ inputs.mongodb_realm_base_url }}
MONGODB_ATLAS_ORG_ID: ${{ inputs.mongodb_atlas_org_id }}
Expand Down Expand Up @@ -544,8 +545,7 @@ jobs:
MONGODB_ATLAS_CLIENT_ID: ${{ secrets.mongodb_atlas_client_id }}
MONGODB_ATLAS_CLIENT_SECRET: ${{ secrets.mongodb_atlas_client_secret }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_REGEX_RUN: '^TestUnexisting' # TODO: SA not implemented in master yet
# ACCTEST_REGEX_RUN: '^TestAccServiceAccount'
ACCTEST_REGEX_RUN: '^TestAccServiceAccount'
ACCTEST_PACKAGES: ./internal/provider
run: make testacc
- name: Acceptance Tests (Service Account smoke tests) # small selection of fast tests to run with SA
Expand All @@ -555,7 +555,7 @@ jobs:
MONGODB_ATLAS_CLIENT_ID: ${{ secrets.mongodb_atlas_client_id }}
MONGODB_ATLAS_CLIENT_SECRET: ${{ secrets.mongodb_atlas_client_secret }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_REGEX_RUN: '^TestUnexisting' # TODO: SA not implemented in master yet
ACCTEST_REGEX_RUN: '^TestAcc' # Don't run migration tests because previous provider versions don't support SA.
ACCTEST_PACKAGES: |
./internal/service/alertconfiguration
./internal/service/databaseuser
Expand Down Expand Up @@ -1150,7 +1150,8 @@ jobs:

resource_policy:
needs: [ change-detection, get-provider-version ]
if: ${{ needs.change-detection.outputs.resource_policy == 'true' || inputs.test_group == 'resource_policy' }}
# Skip in SA as it uses a different org and credentials.
if: ${{ inputs.use_sa == false && (needs.change-detection.outputs.resource_policy == 'true' || inputs.test_group == 'resource_policy') }}
runs-on: ubuntu-latest
permissions: {}
steps:
Expand All @@ -1170,8 +1171,7 @@ jobs:
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.mongodb_atlas_rp_public_key }}
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.mongodb_atlas_rp_private_key }}
MONGODB_ATLAS_LAST_VERSION: ${{ needs.get-provider-version.outputs.provider_version }}
ACCTEST_PACKAGES: |
./internal/service/resourcepolicy
ACCTEST_PACKAGES: ./internal/service/resourcepolicy
run: make testacc

search_deployment:
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ test: fmtcheck ## Run unit tests
@$(eval export MONGODB_ATLAS_ORG_ID?=111111111111111111111111)
@$(eval export MONGODB_ATLAS_PROJECT_ID?=111111111111111111111111)
@$(eval export MONGODB_ATLAS_CLUSTER_NAME?=mocked-cluster)
@$(eval export MONGODB_ATLAS_PUBLIC_KEY=dummy)
@$(eval export MONGODB_ATLAS_PRIVATE_KEY=dummy)
@$(eval export MONGODB_ATLAS_CLIENT_ID=)
@$(eval export MONGODB_ATLAS_CLIENT_SECRET=)
@$(eval export MONGODB_ATLAS_ACCESS_TOKEN=)
go test ./... -timeout=120s -parallel=$(PARALLEL_GO_TEST) -race

.PHONY: testmact
testmact: ## Run MacT tests (mocked acc tests)
@$(eval ACCTEST_REGEX_RUN?=^TestAccMockable)
@$(eval export ACCTEST_REGEX_RUN?=^TestAccMockable)
@$(eval export HTTP_MOCKER_REPLAY?=true)
@$(eval export HTTP_MOCKER_CAPTURE?=false)
@$(eval export MONGODB_ATLAS_ORG_ID?=111111111111111111111111)
Expand All @@ -72,7 +77,7 @@ testmact-capture: ## Capture HTTP traffic for MacT tests

.PHONY: testacc
testacc: fmtcheck ## Run acc & mig tests (acceptance & migration tests)
@$(eval ACCTEST_REGEX_RUN?=^TestAcc)
@$(eval export ACCTEST_REGEX_RUN?=^TestAcc)
TF_ACC=1 go test $(ACCTEST_PACKAGES) -run '$(ACCTEST_REGEX_RUN)' -v -parallel $(PARALLEL_GO_TEST) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -ldflags="$(LINKER_FLAGS)"

.PHONY: testaccgov
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ require (
github.com/zclconf/go-cty v1.17.0
go.mongodb.org/atlas v0.38.0
go.mongodb.org/atlas-sdk/v20240530005 v20240530005.0.0
go.mongodb.org/atlas-sdk/v20240805005 v20240805005.0.1-0.20250402112219-2468c5354718 // uses api-bot-update-v20240805-backport-cluster to support AdvancedConfiguration in create/updateCluster APIs
go.mongodb.org/atlas-sdk/v20241113005 v20241113005.0.0
go.mongodb.org/realm v0.1.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -43,6 +42,7 @@ require (
github.com/hashicorp/terraform-json v0.27.2
github.com/hashicorp/terraform-plugin-framework-jsontypes v0.2.0
go.mongodb.org/atlas-sdk/v20250312008 v20250312008.0.0
golang.org/x/oauth2 v0.31.0
)

require (
Expand Down Expand Up @@ -163,7 +163,6 @@ require (
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/mod v0.27.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/oauth2 v0.31.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1364,8 +1364,6 @@ go.mongodb.org/atlas v0.38.0 h1:zfwymq20GqivGwxPZfypfUDry+WwMGVui97z1d8V4bU=
go.mongodb.org/atlas v0.38.0/go.mod h1:DJYtM+vsEpPEMSkQzJnFHrT0sP7ev6cseZc/GGjJYG8=
go.mongodb.org/atlas-sdk/v20240530005 v20240530005.0.0 h1:d/gbYJ+obR0EM/3DZf7+ZMi2QWISegm3mid7Or708cc=
go.mongodb.org/atlas-sdk/v20240530005 v20240530005.0.0/go.mod h1:O47ZrMMfcWb31wznNIq2PQkkdoFoK0ea2GlmRqGJC2s=
go.mongodb.org/atlas-sdk/v20240805005 v20240805005.0.1-0.20250402112219-2468c5354718 h1:M2mNSBdTkP+paQ1qZ6FliiPdTEbDR9m9qvv4vsWoJAw=
go.mongodb.org/atlas-sdk/v20240805005 v20240805005.0.1-0.20250402112219-2468c5354718/go.mod h1:PeByRxdvzfvz7xhG5vDn60j836EoduWqTqs76okUc9c=
go.mongodb.org/atlas-sdk/v20241113005 v20241113005.0.0 h1:aaU2E4rtzYXuEDxv9MoSON2gOEAA9M2gsDf2CqjcGj8=
go.mongodb.org/atlas-sdk/v20241113005 v20241113005.0.0/go.mod h1:eV9REWR36iVMrpZUAMZ5qPbXEatoVfmzwT+Ue8yqU+U=
go.mongodb.org/atlas-sdk/v20250312008 v20250312008.0.0 h1:Pzrb2bPXtkw1vDTiFxovZyYD4BIA4l0o6c2/HBqxe0I=
Expand Down
Loading