Skip to content

provider now checks for FieldSetNamespaceFromToken being true before prepending token namespace#2926

Merged
vijayavelsekar merged 12 commits into
mainfrom
VAULT-45613/set-namespace-from-token-fix
Jul 8, 2026
Merged

provider now checks for FieldSetNamespaceFromToken being true before prepending token namespace#2926
vijayavelsekar merged 12 commits into
mainfrom
VAULT-45613/set-namespace-from-token-fix

Conversation

@johnjosephg

@johnjosephg johnjosephg commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

The provider now makes sure that set_namespace_from_token is set to true before prepending the namespace of the token to the request, honoring the setting without disturbing existing functionality.

Checklist

  • Added CHANGELOG entry (only for user-facing changes)
  • Acceptance tests where run against all supported Vault Versions

Output from acceptance testing:

go test -v ./vault -run 'TestAccNamespaceProviderConfigure_setNamespaceFromToken' -count=1
=== RUN   TestAccNamespaceProviderConfigure_setNamespaceFromToken
2026/06/25 15:28:53 [INFO] Using Vault token with the following policies: root
=== RUN   TestAccNamespaceProviderConfigure_setNamespaceFromToken/false_does_not_prepend_token_namespace
=== RUN   TestAccNamespaceProviderConfigure_setNamespaceFromToken/true_prepends_token_namespace
--- PASS: TestAccNamespaceProviderConfigure_setNamespaceFromToken (1.87s)
    --- PASS: TestAccNamespaceProviderConfigure_setNamespaceFromToken/false_does_not_prepend_token_namespace (1.07s)
    --- PASS: TestAccNamespaceProviderConfigure_setNamespaceFromToken/true_prepends_token_namespace (0.79s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/vault     2.908s

Output from exisitng unit tests for GetNSClient:

$ go test -v ./internal/provider/ -run 'TestProviderMeta_GetNSClient' -count=1

=== RUN   TestProviderMeta_GetNSClient
=== RUN   TestProviderMeta_GetNSClient/no-resource-data
=== RUN   TestProviderMeta_GetNSClient/basic-no-root-ns
=== RUN   TestProviderMeta_GetNSClient/basic-root-ns
=== RUN   TestProviderMeta_GetNSClient/basic-root-ns-trimmed
--- PASS: TestProviderMeta_GetNSClient (0.00s)
    --- PASS: TestProviderMeta_GetNSClient/no-resource-data (0.00s)
    --- PASS: TestProviderMeta_GetNSClient/basic-no-root-ns (0.00s)
    --- PASS: TestProviderMeta_GetNSClient/basic-root-ns (0.00s)
    --- PASS: TestProviderMeta_GetNSClient/basic-root-ns-trimmed (0.00s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/internal/provider 0.487s

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@johnjosephg johnjosephg marked this pull request as ready for review June 16, 2026 05:55
@johnjosephg johnjosephg requested review from a team as code owners June 16, 2026 05:55
Comment thread internal/provider/meta.go Outdated
Comment thread internal/provider/meta.go Outdated
Comment thread internal/provider/meta.go Outdated
Comment thread internal/provider/meta.go Outdated
Comment thread internal/provider/meta.go
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
@vijayavelsekar vijayavelsekar added this to the 5.11.0 milestone Jun 26, 2026
Comment thread internal/provider/meta.go Outdated
@vijayavelsekar vijayavelsekar force-pushed the VAULT-45613/set-namespace-from-token-fix branch from d967f29 to 0412be1 Compare July 6, 2026 05:43

@vijayavelsekar vijayavelsekar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@vijayavelsekar vijayavelsekar merged commit 21153c9 into main Jul 8, 2026
36 checks passed
@vijayavelsekar vijayavelsekar deleted the VAULT-45613/set-namespace-from-token-fix branch July 8, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants