Add support for default_auth sys backend resource#2846
Add support for default_auth sys backend resource#2846Siddharth-Kannan wants to merge 9 commits intomainfrom
Conversation
…login/default-auth/{name}. Added acceptance tests for the same
There was a problem hiding this comment.
Pull request overview
Adds support in the Terraform Vault provider for managing Vault UI “default auth” login configuration via the /sys/config/ui/login/default-auth/{name} endpoint (Enterprise-only, Vault 1.20.0+), including documentation and acceptance tests.
Changes:
- Introduces
vault_config_ui_default_authresource implementation (CRUD + import support). - Adds acceptance tests for the new resource across supported auth types and scenarios.
- Adds provider registration, constants, CHANGELOG entry, and website documentation for the resource.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
internal/vault/sys/config/ui_default_auth.go |
Implements the vault_config_ui_default_auth resource (schema + CRUD + import). |
internal/vault/sys/config/ui_default_auth_test.go |
Adds acceptance test coverage for CRUD/import and various auth type values. |
website/docs/r/config_ui_default_auth.html.md |
Adds end-user docs, examples, arguments/attributes, and import notes. |
internal/provider/fwprovider/provider.go |
Registers the new framework resource with the provider. |
internal/consts/consts.go |
Adds new field constants used by the resource/tests. |
CHANGELOG.md |
Adds an unreleased FEATURES entry announcing the new resource. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…et to null when users explicitly configured it as "" or "root". Now correctly preserves the user's choice.
…Backend-default-auth
…lds on removal, and prevent namespace drift
| } | ||
|
|
||
| // Always send disable_inheritance - send false if not provided to reset the field | ||
| if !data.DisableInheritance.IsNull() && !data.DisableInheritance.IsUnknown() { |
There was a problem hiding this comment.
Can we simplify this as ValueBool already handles nulls?
| // Handle namespace_path - normalize API response to match user's intent | ||
| // API returns "root/" for root namespace | ||
| // We normalize to either "" or "root" based on what user configured | ||
| if namespacePath, ok := configResp.Data[consts.FieldNamespacePath].(string); ok { |
There was a problem hiding this comment.
Do we have tests covering these scenarios?
| * **New Resources**: `vault_alicloud_secret_backend`, `vault_alicloud_secret_backend_role`, and ephemeral resource `vault_alicloud_access_credentials` for managing AliCloud secrets engine. ([#2858](https://github.com/hashicorp/terraform-provider-vault/pull/2858), [#2874](https://github.com/hashicorp/terraform-provider-vault/pull/2874)) | ||
| * **New Resource**: `vault_plugin_runtime` for managing plugin runtimes in Vault's plugin runtimes catalog. Requires Vault 1.15 or later.([#2835](https://github.com/hashicorp/terraform-provider-vault/pull/2835/)) | ||
| * Add support for CORS configuration: `vault_sys_config_cors` resource and data source for managing and reading Vault's CORS (Cross-Origin Resource Sharing) settings. ([#2849](https://github.com/hashicorp/terraform-provider-vault/pull/2849)) | ||
| * **New Resource**: `vault_config_ui_default_auth` - Manages UI default authentication configuration for the Vault GUI login form. Controls which authentication methods are displayed by default and as backup options for specific namespaces. Supports inheritance control for child namespaces. Enterprise-only feature requiring Vault 1.20.0+. ([#2846](https://github.com/hashicorp/terraform-provider-vault/pull/2846)) |
There was a problem hiding this comment.
This would need to be moved to the Unreleased section once changes are merged from main.
…Backend-default-auth
Description
Implemented vault_config_ui_default_auth resource for /sys/config/ui/login/default-auth/{name}. supports CRUD operations from administrative and root namespaces. Added acceptance test cases for the same. This endpoint only has support from version 1.20.0+ent. versions prior to this are skipped during testing.
NOTE: Acceptance test cases are only for root namespaces, adding acceptance test cases can cause issues with the GitHub CI. Tested manually. added screenshot to acceptance tests for reference. (acceptance tests were run on versions 1.15.0+ent to 1.21.0+ent)
Checklist
Output from acceptance testing:
Community Note
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.